[FFmpeg-user] Extracting stills frames from a DVB-T MPEG transport stream with subtitles

Hans Carlson forbyta at gmx.com
Sat Jun 20 21:17:08 EEST 2020

On Sat, 20 Jun 2020, Tom Crane wrote:

> 	I am attempting to extract still frames from a video stream in a 
> multi-channel DVB-T MPEG transport stream, for example every 2 seconds, 
> with selected accompanying subtitles but can't get it to work.
> This example command successfully extracts frames from video stream 0:26 to 
> jpeg files.
> ffmpeg -i dvb.ts -map 0:26 -qscale:v 1 -r 0.5 stills%04d.jpg
> This one successfully copies the same file's video stream 0:26 along 
> with subtitle stream 0:30 to a video file in a Matroska container.
> ffmpeg -i dvb.ts -map 0:26 -c:v copy -map 0:30 -c:s copy tmp.mkv
> Is there a way to combine the two to capture still frames from the video 
> stream to JPEG files including the accompanying subtitles?

If you want to create 2 images/frame - 1 with the video and another with 
the subtitle, then use your first command for the video and try something 
like the following for the subtitle:

   ffmpeg -i dvb.ts -r 0.5 -lavfi "[0:30]null[sub]" -map "[sub]" subs-%04d.jpg

If you want to combine the video and the sub into a single image, then 
try the overlay filter, eg:

   ffmpeg -i dvb.ts -filter_complex "[0:26][0:30]overlay" -r 0.5 stills-%04d.jpg

Add other options as necessary to get desired quality.  You might want to 
test it on a small section that you know contains subtitles using -ss/-t.

More information about the ffmpeg-user mailing list