[x264-devel] Bit stuffing/padding

Jason Garrett-Glaser jason at x264.com
Wed Aug 8 04:32:24 CEST 2012


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


More information about the x264-devel mailing list