[x264-devel] Bit stuffing/padding

Tim Pitman tapitman11 at gmail.com
Wed Aug 8 08:20:43 CEST 2012


So when x264 writes to the pipe it doesn't wait until it has a
complete NALU before writing?

I've been considering switching to using libx264 directly but my
source is a webcam that I'm using ffmpeg to read so I would have to
implement libavformat/libavcodec on that side as well. Is there a
better way to get webcam data into x264?

On Tue, Aug 7, 2012 at 7:32 PM, Jason Garrett-Glaser <jason at x264.com> wrote:
> On Tue, Aug 7, 2012 at 6:13 PM, Tim Pitman <tapitman11 at gmail.com> wrote:
>> I'm running this on Linux and the use case is low latency video over a
>> lossy wireless channel.
>>
>> I'm using x264 to encode and piping the results to another application
>> I'm developing. My application must process the data at a very
>> specific bitrate before transmitting it. Using --nal-hrd,
>> --vbv-maxrate, and --bitrate I've been able to get the output rates of
>> x264 very close to the desired input rate, but there is still a slight
>> mismatch. The solution I'm currently working on is adding my own
>> padding in addition to that done by --nal-hrd. Basically if my
>> application goes to read from the pipe x264 is writing to and there
>> isn't enough data to fill that frame (105 bytes), I simply insert
>> 0xFFs until I have a complete frame. I'm making the assumption that
>> x264 will always output on NALU boundaries.
>
> There's no such guarantee with a pipe; piping happens within the shell
> and operating system, which have no knowledge of what a NALU is.  It's
> just data with a buffer.
>
> If you want to build an application like this, call libx264 directly.
> Piping is not suitable for anything even close to what you're doing.
>
> Jason
> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> http://mailman.videolan.org/listinfo/x264-devel


More information about the x264-devel mailing list