LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-29-2012, 11:22 AM   #1
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Rep: Reputation: 31
ffmpeg convert to avi for Haier HEC 110 DVD player


A file with this info plays in my dvd player from an SD card:

Code:
  Metadata:
    ISFT            : Some super fast AVI muxer 
  Duration: 00:46:44.95, start: 0.000000, bitrate: 1046 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 624x352 [PAR 1:1 DAR 39:22], 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, 2 channels, s16, 40 kb/s

However, when I convert an mp4 to an avi using this command:
Code:
ffmpeg -i file.mp4 -f avi file.avi
and end up with this file information:
Code:
  Metadata:
    ISFT            : Lavf52.61.0
    Stream #0.0(eng): Video: mpeg4, yuv420p, 720x406 [PAR 1:1 DAR 360:203], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0.1(und): Audio: mp2, 48000 Hz, stereo, s16, 64 kb/s

One thing, of course, is the audio, but maybe I'm missing something else?


As far as the audio is concerned, I do have an mp3 codec:
Code:
ffmpeg -codecs
...
Code:
 D A    mp3             MP3 (MPEG audio layer 3)
 D A    mp3adu          ADU (Application Data Unit) MP3 (MPEG audio layer 3)
 D A    mp3on4          MP3onMP4

however

Code:
ffmpeg -i file.mp4 -f avi -acodec mp3 file.avi
gives me:
Code:
Unknown encoder 'mp3'

My basic questions then are:
1) If the first video plays on the DVD player from a USB port, what other reason besides the audio format might the second video not play?

2) How can I ensure that when I convert a video, sound is encoded in mp3 format?

Last edited by secretlydead; 08-29-2012 at 11:47 AM.
 
Old 08-29-2012, 11:43 AM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
you could try converting it to mpeg
such as
Code:
ffmpeg -i file.mp4 -target {ntsc,pal}-dvd file.mpg
 
Old 08-29-2012, 11:49 AM   #3
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by secretlydead View Post
However, when I convert an mp4 to an avi using this command:


and end up with this file information:
No command there. Please repost it
Quote:
Originally Posted by secretlydead View Post
One thing, of course, is the audio, but maybe I'm missing something else?
Could be. The DVD-player could be looking at the FOURCC of the avi file to look if the codec used is supported (you can obviously override this with a ffmpeg option) or the video bitrate etc.
Quote:
Originally Posted by secretlydead View Post
As far as the audio is concerned, I do have an mp3 codec:
>ffmpeg -codecs
...
D A mp3 MP3 (MPEG audio layer 3)
D A mp3adu ADU (Application Data Unit) MP3 (MPEG audio layer 3)
D A mp3on4 MP3onMP4
This list tells you that you can only Decode mp3 files with ffmpeg. To encode them, you'd need to install lame and recompile ffmpeg with explicit support to libmp3lame.
Quote:
Originally Posted by secretlydead View Post
however
Code:
ffmpeg -i file.mp4 -f avi -acodec mp3 file.avi
gives me:
Unknown encoder 'mp3'
The correct acodec option would be libmp3lame, not mp3
 
2 members found this post helpful.
Old 08-29-2012, 03:46 PM   #4
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
For the one that DOES PLAY on my dvd player:

Code:
ffprobe -show_streams file.avi|grep codec_tag
gives:

Code:
codec_tag_string=XVID
codec_tag=0x44495658
codec_tag_string=U[0][0][0]
codec_tag=0x0055
For the one that DOES NOT play:

Code:
ffprobe -show_streams *avi |grep codec_tag
gives:

Code:
codec_tag_string=FMP4
codec_tag=0x34504d46
codec_tag_string=U[0][0][0]
codec_tag=0x0055

not sure if the FOURCC is causing the issue and it can be simply changed, or if it is encoded wrong. will try to answer if non one else does.
 
Old 08-29-2012, 04:20 PM   #5
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
In conclusion, for the thousands and thousands of people using a linux box to convert video's for use on the Haier HEC 110 DVD player:

Code:
ffmpeg -i file.mp4 -f avi -vtag XVID -b 897k -acodec libmp3lame file.avi
Of course, this will probably work with a lot of different dvd players that need to play DIVX or AVI's or whatever.

The audio codec is probably not necessary, in fact, but that's where the path lead me.

One other change, the:
-b 897k
I put that there so it would match the input, as it seems to default to 200kb/s:

Code:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : muxer
  Duration: 00:47:01.41, start: 0.000000, bitrate: 1019 kb/s
    Stream #0.0(eng): Video: h264, yuv420p, 720x406 [PAR 64757:64800 DAR 319:180], 897 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47.95 tbc
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 116 kb/s
File 'file.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'file.avi':
  Metadata:
    ISFT            : Lavf52.61.0
    Stream #0.0(eng): Video: mpeg4, yuv420p, 720x406 [PAR 1:1 DAR 360:203], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0.1(und): Audio: libmp3lame, 48000 Hz, stereo, s16, 64 kb/s
So it was the FOURCC - thanks.
 
Old 08-30-2012, 01:40 AM   #6
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
No problem.
To achieve a better video quality you should consider performing a 2-pass encoding or raising the bitrate.
There's an option (-sameq) which tries to obtain the same video quality of the input file by automatically adjusting bitrate and quantizer.
 
Old 09-01-2012, 12:00 AM   #7
andrew.46
Senior Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 1,364

Rep: Reputation: 493Reputation: 493Reputation: 493Reputation: 493Reputation: 493
Quote:
Originally Posted by secretlydead View Post
In conclusion, for the thousands and thousands of people using a linux box to convert video's for use on the Haier HEC 110 DVD player:

Code:
ffmpeg -i file.mp4 -f avi -vtag XVID -b 897k -acodec libmp3lame file.avi
Of course, this will probably work with a lot of different dvd players that need to play DIVX or AVI's or whatever.
I don't possess one of these DVD players but perhaps the following would give a slightly better encode, but you may need a current git version of FFmpeg:

Code:
ffmpeg -y -i file.mp4 -threads auto \
-c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
-c:a libmp3lame -ac 2 -q:a 3 -ar 44100 \
file.avi"
You could fiddle the quality settings for both video and audio until you found an acceptable size / quality ratio.
 
Old 09-04-2012, 08:42 PM   #8
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
These work in the DVD player:

Code:
  Duration: 01:15:51.04, start: 0.000000, bitrate: 1509 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 720x384 [PAR 1:1 DAR 15:8], 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 128 kb/s
    Metadata:
      strn            : VTS_01_1 T80 3_2ch 448Kbps DELAY 0ms_new
codec_tag_string=XVID
858 MB
Code:
Seems stream 0 codec frame rate differs from container frame rate: 24000.00 (24000/1) -> 23.98 (24000/1001)
  Metadata:
    ISFT            : Lavf52.61.0
  Duration: 00:47:06.04, start: 0.000000, bitrate: 903 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 720x404 [PAR 1:1 DAR 180:101], 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
    Stream #0.1: Audio: mp3, 48000 Hz, 2 channels, s16, 64 kb/s
codec_tag_string=XVID
319 MB
These do not:
Code:
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
  Metadata:
    ISFT            : Lavf52.61.0
  Duration: 01:17:12.96, start: 0.000000, bitrate: 825 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
    Stream #0.1: Audio: mp2, 48000 Hz, 2 channels, s16, 64 kb/s
codec_tag_string=XVID
478 MB
Code:
[mpeg4 @ 0x9494690]Invalid and inefficient vfw-avi packed B frames detected
  Metadata:
    ISFT            : VirtualDubMod 1.5.10.2 (build 2540/release)
  Duration: 01:30:51.52, start: 0.000000, bitrate: 1075 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 624x336 [PAR 1:1 DAR 13:7], 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, 2 channels, s16, 128 kb/s
codec_tag_string=XVID
732 MB

Is there anything within this information that jumps out and tells you why the first two work while the second two do not?
 
Old 09-05-2012, 04:05 AM   #9
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
The first non-working avi file is a 30 fps file, which your player likely doesn't support.
Regarding the second non-working file, reading these messages I think you should fix the reported error by recreating the avi file with avidemux (as suggested by one user on that mailing list) or another tool. Maybe ffmpeg itself is sufficient for this, specifying "copy" as acodec and vcodec:
Code:
ffmpeg -i non-working-avi.avi -acodec copy -vcodec copy new-avi.avi
 
Old 09-05-2012, 02:35 PM   #10
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
It was the size of the screen.

The tag

-s svga

did it.

so the final solution is:

Code:
ffmpeg -i file.mp4 -f avi -vtag XVID -b 897k -acodec libmp3lame -s svga file.avi
with an optional -pass 2 but that produces a bug on my version.

The video I'm transcoding is available from http://jimgaffigan.com/ for $5 by the way. Very funny comedian.
 
Old 09-14-2012, 09:08 AM   #11
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
Since pass 2 doesn't work on ffmpeg or avconv, I've started to use avidemux as suggested here.
 
Old 09-14-2012, 09:11 AM   #12
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
What were the errors reported by ffmpeg/avconv?
If you'd like a more "batchable" solution you can give a try at xvidenc.
 
Old 09-14-2012, 09:07 PM   #13
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
This works:

Code:
Input #0, avi, from 'test.avi':
  Duration: 00:00:42.74, start: 0.000000, bitrate: 1483 kb/s
    Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 800x450 [PAR 1:1 DAR 16:9], 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
This doesn't:

Code:
Input #0, avi, from 'test2.avi':
  Duration: 02:34:29.46, start: 0.000000, bitrate: 1641 kb/s
    Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 800x450 [PAR 1:1 DAR 16:9], 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
The difference I see is just in the length of the video. Could it be anything else?




Thanks, I installed xvidenc and will take a look.

The error for ffmpeg was all over the Internet with no solution, but here it is again anyway, as simple as i could test it (I tried for hours to solve this):

Code:
dan@danlaptop:/dir$ avconv -i thing.mkv -pass 2 thing.avi
avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jun 12 2012 16:37:58 with gcc 4.6.3
[matroska,webm @ 0x809f240] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'thing.mkv':
  Duration: 01:59:32.33, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (Main), yuv420p, 960x540, PAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0.1: Audio: aac, 44100 Hz, stereo, s16 (default)
[buffer @ 0x80e10a0] w:960 h:540 pixfmt:yuv420p
Cannot read file 'av2pass-0.log': No such file or directory
Error reading log file 'av2pass-0.log' for pass-2 encoding
dan@danlaptop:/dir$ touch av2pass-0.log
dan@danlaptop:/dir$ chmod 777 av2pass-0.log
dan@danlaptop:/dir$ avconv -i thing.mkv -pass 2 thing.avi
avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jun 12 2012 16:37:58 with gcc 4.6.3
[matroska,webm @ 0x9d5b240] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'thing.mkv':
  Duration: 01:59:32.33, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (Main), yuv420p, 960x540, PAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0.1: Audio: aac, 44100 Hz, stereo, s16 (default)
File 'thing.avi' already exists. Overwrite ? [y/N] y
[buffer @ 0x9d9d0a0] w:960 h:540 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
Output #0, avi, to '/dir/thing.avi':
    Stream #0.0: Video: mpeg4, yuv420p, 960x540 [PAR 1:1 DAR 16:9], q=2-31, pass 2, 200 kb/s, 90k tbn, 29.97 tbc (default)
    Stream #0.1: Audio: [0][0][0][0] / 0x0000, 44100 Hz, stereo, flt, 200 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (aac -> ac3)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
 
Old 09-15-2012, 03:20 PM   #14
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
You sure you've performed pass 1 prior to pass 2?
Pass 1 could be safely redirected to /dev/null as it's only needed for the log file...
 
Old 09-16-2012, 01:11 PM   #15
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
oops.

i didn't realize that -pass was telling what pass it's supposed to be doing, rather than just instructing it to do two passes.

i'll work on this and write a script that splits my files into chunks small enough to play on this dvd player.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Convert flv to dvd w/ ffmpeg agrestic Linux - General 6 10-18-2009 11:05 PM
ffmpeg: howto convert dvd/mkv to avi? G00fy Linux - Software 2 01-14-2009 11:25 AM
Convert from avi to DVD gabsik Linux - General 4 12-18-2008 01:28 PM
convert .avi's to play on a dvd player kryptobs2000 Linux - Software 8 01-11-2007 11:23 PM
avi to dvd with ffmpeg Synesthesia Linux - Software 9 03-06-2006 12:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration