I've Googled this problem, and I can find examples of people using presets and proper syntax for two-pass H.264 encodes using x264, but I don't want to just copy-paste them; I want to understand what I'm doing wrong here. The documentation doesn't go into much detail regarding this.
So here's what I'm running, using ffmpeg on Windows, a January 14 2013 build.
ffmpeg -i pelicans.mpg -c:v libx264 -pass 1 -an -f rawvideo NUL
ffmpeg -i pelicans.mpg -c:v libx264 -q:v 5 -pass 2 -an pelicout.mkv
Error: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width, or height.
The first command works correctly. The second is what gives me trouble. If I use -b:v 2500k, then that works fine. But -q:v 9 does not, and I haven't been able to understand why. If I invoke that command outside of a two-pass encode, it seems to work fine. And it's in the same position a flat bitrate indicator would be. So what's the deal here? What am I doing wrong?
+ Reply to Thread
Results 1 to 5 of 5
-
-
Usually with 2pass encodes, you enter a desired average bitrate, which is the same for pass1 and pass2. I suspect that's what it's expecting too - thus the error
Why are you using -q:v ? Did you want same constant quantizer encoding (--qp in x264CLI) or crf encoding ? For ffmpeg, -crf is the equivalent to --crf in x264CLI . Both crf and qp encoding are 1pass encodes -
Ah, see, that's what I didn't know. Though it makes sense now that I think about it.
So is two-pass encoding only done these days when having a specific and predictable filesize the main concern, and CRF/QP encoding done when quality is more important? -
Yes, when you need a specific bitrate or filesize, use 2pass . Common scenarios are fixed capacity limitations (e.g. blu-ray media, maybe streaming bandwidth limitations)
When average quality, but don't care as much about final bitrate is more important, CRF encoding is used. The final bitrate will vary accorrding to content complexity, and you will achieve an average quality proportional to the CRF value entered. Almost nobody uses QP encoding (constant quantizer), there is no reason to since CRF is better in every way -
reading:
http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
and
https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping
might also help a bit with handling x264 and ffmpeg
Similar Threads
-
Why doesn't Handbrake trim a movie when I set the "--start-at" parameter?
By falco2000 in forum Video ConversionReplies: 3Last Post: 1st Oct 2012, 08:56 -
how we can implement "VirtualDub" or "FFmpeg" with my C# windows applicati
By dhemittal in forum ProgrammingReplies: 0Last Post: 8th Jun 2010, 07:17 -
ffmpegX won't convert files due to "syntax error near unexpected token"
By JayEm in forum ffmpegX general discussionReplies: 1Last Post: 15th Feb 2010, 17:26 -
"if" syntax error
By njitram2000 in forum Authoring (DVD)Replies: 2Last Post: 8th Nov 2009, 11:30 -
"--norollup" parameter seems not to work in ccextractor
By polarwhite in forum SubtitleReplies: 0Last Post: 13th Oct 2008, 22:10