Aegwyn11
15th April 2012, 18:08
Hi there. First let me apologize if this is a noob question...I've searched a ton all over the place and figured a lot out on my own, but I'm sort of stuck. I'm slowing figuring out FFmpeg and x264, but need a little help. I've gotten to a point where I can make good single pass encodes, but need some help understanding two pass. I understand the 'reason' for using two pass is to achieve a desired bitrate with max quality, which is why I'm interested in it.
So I've figured out how to use the VBV/HRD settings, as well as all the necessary stuff to make interlaced work (my source in this case is interlaced). I've searched a ton about 2 pass encoding and find lots of references along the lines of "if you don't care about file size, use CRF; if you need a specific bitrate, use 2pass" but noone ever really talks very specifically about -how- to use two pass. I understand the the second pass should be done using -bitrate for rate control, but what about the first pass?
For the application that's in front of me right now, my source is a Prores 422 file that I decoded to v210 using QT Pro (avcodec's Prores decoder doesn't handle stream problems nearly as elegantly as QT). I use FFmpeg compiled with 10-bit x264 with the v210 file as an input to encode h.264 and mux into a TS. Basically what I've been doing is setting CRF to a low low number (1) and letting x264 control the rate using VBV. I need an average bitrate no more than 80 Mbps (video) and it needs to adhere to Hi422P at (no more than) level 4.2, but the video can go above 80 at times if needed. VBR video is totally fine, as long as the resulting TS is CBR.
So I tried doing a first pass encode setting -muxrate 87000000 -x264opts crf=1:vbv-maxrate=85000:vbv-bufsize=70000:nal-hrd=vbr. Once this completed, I ran the second pass, just changing crf=1 to bitrate=80000. As the encode ran, I got a bunch of warnings that pts<dts, invalid TS from time to time (same thing you get if you set a muxrate and too low CRF without VBV).
So I guess my question is - for my application (highest quality possible, 80 Mbps average bitrate, Hi422P@L4.2 or lower, muxed into a valid CBR transport stream), what kind of two pass settings should I be using?
So I've figured out how to use the VBV/HRD settings, as well as all the necessary stuff to make interlaced work (my source in this case is interlaced). I've searched a ton about 2 pass encoding and find lots of references along the lines of "if you don't care about file size, use CRF; if you need a specific bitrate, use 2pass" but noone ever really talks very specifically about -how- to use two pass. I understand the the second pass should be done using -bitrate for rate control, but what about the first pass?
For the application that's in front of me right now, my source is a Prores 422 file that I decoded to v210 using QT Pro (avcodec's Prores decoder doesn't handle stream problems nearly as elegantly as QT). I use FFmpeg compiled with 10-bit x264 with the v210 file as an input to encode h.264 and mux into a TS. Basically what I've been doing is setting CRF to a low low number (1) and letting x264 control the rate using VBV. I need an average bitrate no more than 80 Mbps (video) and it needs to adhere to Hi422P at (no more than) level 4.2, but the video can go above 80 at times if needed. VBR video is totally fine, as long as the resulting TS is CBR.
So I tried doing a first pass encode setting -muxrate 87000000 -x264opts crf=1:vbv-maxrate=85000:vbv-bufsize=70000:nal-hrd=vbr. Once this completed, I ran the second pass, just changing crf=1 to bitrate=80000. As the encode ran, I got a bunch of warnings that pts<dts, invalid TS from time to time (same thing you get if you set a muxrate and too low CRF without VBV).
So I guess my question is - for my application (highest quality possible, 80 Mbps average bitrate, Hi422P@L4.2 or lower, muxed into a valid CBR transport stream), what kind of two pass settings should I be using?