Log in

View Full Version : A way to strip certain frame types from a H.264 elementary stream


benwaggoner
24th January 2014, 18:38
For complex reasons, I want to test some encodes using a tool that can't handle B-frames. The simplest way to handle this would be to simply strip the B-frames out of an existing encode, while retaining other frame types and their timestamps.

Anyone know a way to easily remux or generate a new elementary stream that strips out/preserves certain frame types, while leaving the other frames alone?

This seems like something ffmpeg probably has a magic way to do, but I didn't find it :).

Kurtnoise
25th January 2014, 08:13
Not tested but something like that :

ffmpeg -i input.h264 -vf select='eq(pict_type\,I,P,S,SI,SP)' output.h264

https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect

nevcairiel
25th January 2014, 09:20
This will actually re-encode the stream, and drop all frames that were B-Frames in the old bitstream, without actually ensuring the re-encode won't have new B-Frames.
FFmpeg doesn't have such advanced filtering features for compressed bitstreams.

SeeMoreDigital
25th January 2014, 10:57
I can't offer any help... but I seem to remember enquiring about something similar many years ago when I was testing various hardware media players who's A/V decoding chip-sets would only support MPEG-4 SP video.


Cheers