[FFmpeg-devel] avformat/movenc: add param for filtering nal types

Hendrik Leppkes h.leppkes at gmail.com
Tue Mar 6 19:27:18 EET 2018

On Tue, Mar 6, 2018 at 3:51 PM, Eran Kornblau <eran.kornblau at kaltura.com> wrote:
> Hi all,
> The attached patch adds a parameter that enables the user to choose which AVC/HEVC NAL units to include in the output.
> The parameter is supplied as a bitmask in order to keep things simple.
> A short background on why we need it - in our transcoding process, we partition the video in chunks, the chunks are
> transcoded in parallel and packaged in MPEG-TS container. The transcoded TS chunks are then concatenated and
> packaged in MP4. These MP4 files are later repackaged on-the-fly to various protocols (HLS/DASH etc.) using our
> JIT packager.
> For performance reasons (can get into more detail if anyone's interested...), when packaging the MP4 to DASH/CENC,
> we configure the packager to assume that each AVC frame contains exactly one NAL unit.
> The problem is that the transition through MPEG-TS adds additional NAL units (NAL AUD before each frame + SPS/PPS
> before each key frame), and this assumption fails.
> Using the attached patch we can pass '-nal_types_mask 0x3e' which will make ffmpeg output only VCL NALs in the stream.

Having such logic in one single muxer is not something we really like
around here. Next time someone needs something similar for another
codec, you're stuck re-implementing it.

To achieve the same effect, Mark Thompson quickly wipped up a
Bitstream Filter using his CBS framework which achieves the same
result. He'll be sending that patch to the mailing list in a while.

- Hendrik

More information about the ffmpeg-devel mailing list