Satyam Rao
Satyam Rao

Reputation: 13

How to Remove a frame from an HEVC bitstream?

I have an HEVC encoded bitstream (.bin and equivalent .mp4 file). I want to remove some frames from the bitstream to see how a decoder (or media player) behaves when a particular frame is lost.

enter image description here

How I can remove a frame (or a NAL unit) from the bitstream? What tools can be used?

Thanks

Upvotes: 1

Views: 722

Answers (1)

Gyan
Gyan

Reputation: 93018

With ffmpeg, you can use the drop option of the noise bitstream filter.

ffmpeg -i IN -c copy -bsf:v noise=drop=between(n\,20\,30) OUT

This will drop packets #20-30 from the video stream. This bsf is codec-agnostic.

For a few codecs (H.264, H.265, MJPEG, MPEG2, VP9, AV1), you have the filter_units bsf.

e.g.

ffmpeg -i IN -c copy -bsf:v 'filter_units=remove_types=35|38-40' OUT

The unit type values will depend on the codec. Consult the codec standard document for nal_unit_type or a similar parameter.

Upvotes: 0

Related Questions