How to Output Raw Frame Data in ffmpeg

Asked 2 years ago, Updated 2 years ago, 75 views

In order to output a still image of a video using ffmpeg, you can output it using the following methods:

$ffmpeg-i Original Video .avi-ss144-t148-r24-image2%06d.jpg

Is there a way to output raw I, B, and P frames?

ffmpeg

2022-09-30 14:15

2 Answers

It's a bitstream.The original video codec is mpeg2.

Simply extracting the MPEG-2 Video bitstream is possible with the following commands:

ffmpeg-i input.ts-c:v copy-fmpeg2 video output.mp2v

Note: AVI containers cannot "correctly" store MPEG-2 Video streams containing B frames. There is a workaround called "Packaged B-frame", but it is up to the video player to handle it correctly.Avoid using AVI containers when handling MPEG-2 Video.

Is there a way to output raw I, B, and P frames?

FFmpeg as a tool probably doesn't have that kind of function.

  • (as mentioned in Cubick's answer) Video Filter is a filtering process for decoded video frames.
  • There is also a BitStream Filter (bsf) that handles bit streams, but it does not provide the desired filter.

"Also, even if ""P/B frame only"" data can be retrieved, video decoding cannot be performed correctly with that data alone."Unless you're developing MPEG-2 decoders and analysis tools, otherwise data that doesn't contain I-frames will have no use at all use.
"Also, ""I-frame only data"" can be decoded completely, so it may be meaningful."


2022-09-30 14:15

The select filter seems to be able to output.

  • B frame
    -vf select=eq(pict_type\,B)
  • P frame
    -vf select=eq(pict_type\,P)
  • I-Frame
    -vf select=eq(pict_type\,I) or -skip_frame nokey

Note:
[ffmpeg]How to print a specific frame from a video as an image: Niconico Video Institute


2022-09-30 14:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.