I have a HEVC mkv video from which I need to remove all but key frames without re-encoding whole thing.
I found out that I can extra key frames using this
ffmpeg -i full.mkv -c:v copy -vf "select=eq(pict_type\,PICT_TYPE_I)" key.mkv
but I get:
Filtergraph 'select=eq(pict_type\,PICT_TYPE_I)' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together.
What do I do?
You'll have to use the bitstream filter filter_units
for this:
ffmpeg -i test.mkv -c copy -map v -bsf:v "filter_units=pass_types=16-23|32-34" key.mkv
This will only pass through random access pictures from the HEVC stream. This should cover most of them but HEVC has more keyframes types than H.264 so I'll update the types above if there are some I've missed.