VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Hi,

    I thought I'd try to ask my FFMPEG question in here. Also posted on the FFMPEG forum but theres not much going on there (I'll keep both places updated). I'm trying to convert to MPEG-4 using FFMPEG, but the second pass fails on start:

    I'm using these 2 lines (from WinFF) trying to do 2-pass:

    "C:\Program Files\WinFF\ffmpeg.exe" -i "C:\Kamera\020.MOV" -crf 15.0 -vcodec libx264 -acodec libfaac -ar 48000 -ab 192k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 -an -passlogfile "C:\Kamera\020.log" -pass 1 -y "NUL.avi"

    "C:\Program Files\WinFF\ffmpeg.exe" -y -i "C:\Kamera\020.MOV" -crf 15.0 -vcodec libx264 -acodec libfaac -ar 48000 -ab 192k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 -passlogfile "C:\Kamera\020.log" -pass 2 "C:\Kamera\020.mp4"

    The first pass completes but the second fails on start with this message: "Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height".

    Can anyone spot the culprit in these commands?

    --
    Werner
    Quote Quote  
  2. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    In the command for the second pass, try adding:
    -b 2000k
    where 2000k is the video bitrate you want.

    "C:\Program Files\WinFF\ffmpeg.exe" -y -i "C:\Kamera\020.MOV" -crf 15.0 -vcodec libx264 -b 2000k -acodec libfaac -ar 48000 -ab 192k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 -passlogfile "C:\Kamera\020.log" -pass 2 "C:\Kamera\020.mp4"
    Quote Quote  
  3. Thanks, it turned out to be half the needed changes. At first it didn't work but then I tried to remove the "-crf 15.0" option which allowed me to complete pass 2. But according to the documentation that option is a must. But perhaps this only applies for 1-pass convertion?

    --
    Werner
    Quote Quote  
  4. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by ITemplate View Post
    Thanks, it turned out to be half the needed changes. At first it didn't work but then I tried to remove the "-crf 15.0" option which allowed me to complete pass 2.
    Whoops... you're right. I copied and pasted your command line example, but missed out the '-crf' option.

    But according to the documentation that option is a must. But perhaps this only applies for 1-pass convertion?
    From the x264 mapping and options guide:
    (crf) "Constant quality mode (also known as constant ratefactor). Bitrate corresponds approximately to that of constant quantizer, but gives better quality overall at little speed cost. The best one-pass option in x264."
    - so it looks like crf is only intended for single pass encoding.

    The article also mentions that the '-b' option is "generally the worst ratecontrol mode x264 has". But I don't know if that statement is true for both 1 pass and 2 pass encoding. You'd need to ask an ffmpeg/x264 guru

    You might want to give 1-pass encoding a try as well. I'm quite impatient, and usually stick to single pass encoding, using -b or -crf.
    *When I first tried 1-pass encoding with -crf, ffmpeg didn't seem to obey it. I found out that adding the '-qcomp' parameter got round the problem:
    ffmpeg -i input.mp4 -vcodec libx264 -acodec libmp3lame -ar 44100 -ab 192k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -crf 10 output.mp4

    I've experimented with different values for -crf; anywhere from 5-20 seems reasonable (a lower crf number produces higher quality video and a larger filesize). It's a good idea to experiment with different values on a short video clip to determine the best quality/filesize compromise.
    Last edited by intracube; 1st Jul 2011 at 11:33.
    Quote Quote  
  5. Member
    Join Date
    Nov 2009
    Location
    United States
    Search Comp PM
    Why use two passes unless you are trying to hit a certain size. Otherwise use -crf and be done in one pass.
    Quote Quote  
  6. Originally Posted by intracube View Post
    You might want to give 1-pass encoding a try as well. I'm quite impatient, and usually stick to single pass encoding, using -b or -crf.
    *When I first tried 1-pass encoding with -crf, ffmpeg didn't seem to obey it. I found out that adding the '-qcomp' parameter got round the problem:
    ffmpeg -i input.mp4 -vcodec libx264 -acodec libmp3lame -ar 44100 -ab 192k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -crf 10 output.mp4

    I've experimented with different values for -crf; anywhere from 5-20 seems reasonable (a lower crf number produces higher quality video and a larger filesize). It's a good idea to experiment with different values on a short video clip to determine the best quality/filesize compromise.
    THanks intracube, really appreciated. I have played with FFMPEG settings and for streaming (to PS3) it performs quite well and I'm pleased with the quality when compared to other applications. But it seems I have to dig into the 1-pass v/s 2-pass a little more...I'd rather just settle for 1-pass if the quality loss isn't noticable...

    --
    Werner
    Quote Quote  
  7. Originally Posted by V1de0Luvr View Post
    Why use two passes unless you are trying to hit a certain size. Otherwise use -crf and be done in one pass.
    Well because (in theory as I understand it) while 2-pass will deliver a more predictable size, it will still deliver a better convertion. In pass one it will detect things that are used to do the actual convertion in pass 2. E.g. sound should be more accurate sync'ed.

    Is that wrong understanding of 2-pass?

    --
    Werner
    Quote Quote  
  8. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by ITemplate View Post
    Well because (in theory as I understand it) while 2-pass will deliver a more predictable size, it will still deliver a better convertion. In pass one it will detect things that are used to do the actual convertion in pass 2. E.g. sound should be more accurate sync'ed.
    I don't think 2-pass encoding would improve the audio sync.

    From what I've read, there are two main advantages to 2-pass encoding:
    - being able to encode videos to a more precise target filesize
    - improving the picture quality by more effectively allocating bits to the parts of the video that need them most (fast movement, complex scenes).

    But, as I say, I very rarely do 2-pass encoding. You could do a comparison of 1-pass vs 2-pass with a short video clip to decide whether it's worth the extra time.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!