Extracting stills frames from a DVB-T MPEG transport stream with subtitles

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Extracting stills frames from a DVB-T MPEG transport stream with subtitles

TPCffmpeg
Dear All,
  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?


The relevant part of the dvb.ts file's contents from ffprobe are,

Input #0, mpegts, from
'dvb.ts':
   Duration: 00:02:00.18, start: 52229.147411, bitrate: 24040 kb/s
   Program 1542
     Metadata:
       service_name    : TMC
       service_provider: SMR6
     Stream #0:26[0x26c]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
     Stream #0:27[0x276](fra): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
     Stream #0:28[0x277](qaa): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
     Stream #0:29[0x278](fra): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 96 kb/s (visual impaired) (descriptions)
     Stream #0:30[0x28a](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
     Stream #0:31[0x28b](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
     Stream #0:7[0xaa]: Unknown: none ([5][0][0][0] / 0x0005)


$ ffmpeg -version
ffmpeg version N-96647-g343ccfcc4d Copyright (c) 2000-2020 the FFmpeg
developers
built with gcc 9.2.0 (GCC)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
--docdir=/usr/doc/ffmpeg-git-20200206/html --mandir=/usr/man
--disable-debug --enable-shared --disable-static --enable-gpl
--enable-version3 --enable-avresample --arch=x86_64 --disable-encoder=aac
--enable-libfontconfig --enable-libfreetype --enable-libfribidi
--enable-gnutls --enable-libbluray --enable-libcaca --enable-libcdio
--enable-libopus --enable-librtmp --enable-libspeex --enable-libssh
--enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid
--enable-libmp3lame --enable-opencl --enable-opengl --enable-libopenjpeg
--enable-libpulse --enable-libsmbclient --enable-libwavpack
libavutil      56. 39.100 / 56. 39.100
libavcodec     58. 68.100 / 58. 68.100
libavformat    58. 38.100 / 58. 38.100
libavdevice    58.  9.103 / 58.  9.103
libavfilter     7. 74.100 /  7. 74.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  6.100 /  5.  6.100
libswresample   3.  6.100 /  3.  6.100
libpostproc    55.  6.100 / 55.  6.100

Thanks
Tom Crane
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Extracting stills frames from a DVB-T MPEG transport stream with subtitles

Hans Carlson-2
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.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Extracting stills frames from a DVB-T MPEG transport stream with subtitles

TPCffmpeg
On Sat, 20 Jun 2020, Hans Carlson wrote:

> 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.
>>

[cut]

> 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

Many thanks for that which does exactly what I wanted.

> Add other options as necessary to get desired quality.

Adding '-qscale:v 1' provided the required quality.

Best regards
Tom Crane
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".