How can I extract keyframe and p-frame from stream with single command using ffmpeg

0

I want to extract two kind of frames from a tv stream using ffmpeg at the same time.

My question is how can I get two two I and P frames using one single command?

e.g : command to get all keyframes in ffmpeg :

ffmpeg -i http://my-tv-stream.m3u8 -vf "select=eq(pict_type\,I)" -vsync vfr -qscale:v 2 thumbnails-%02d.jpeg

Seyed Vahid Hashemi

Posted 2016-08-03T11:15:44.300

Reputation: 153

Answers

1

Use

ffmpeg -i http://my-tv-stream.m3u8 -vf "select='eq(pict_type\,I)+eq(pict_type\,P)'" -vsync vfr -qscale:v 2 thumbnails-%02d.jpeg

To output the frame types separately, use

ffmpeg -i http://my-tv-stream.m3u8 -vf "select='eq(pict_type\,I)" -vsync vfr -qscale:v 2 I-thumbnails-%02d.jpeg
       -vf "select='eq(pict_type\,P)" -vsync vfr -qscale:v 2 P-thumbnails-%02d.jpeg

Gyan

Posted 2016-08-03T11:15:44.300

Reputation: 21 016

I forgot to ask about this issue as well. how can I indicate the type of output images by the type of frames then? – Seyed Vahid Hashemi – 2016-08-03T11:57:00.407

Edited into answer. – Gyan – 2016-08-03T13:16:55.760