[FFmpeg-user] Extract Subtitle as png and/or burn them to screenshot

Benedict Breuer benedict.breuer at gmail.com
Mon Oct 15 18:16:32 CEST 2012


Hi,

I learned how to extract a screenshot/thumbnail every 60 second from
my input video:

ffmpeg -i myvideo.avi -f image2 -r 1/60 img%03d.jpg

http://ffmpeg.org/trac/ffmpeg/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video

That works very fine for me. Now cames an addational request: My input
is an AVCHD file containing the camera time as a subtitle:

ffprobe input.mts
FFprobe version 0.6.6-4:0.6.6-0ubuntu0.11.04.1, Copyright (c)
2007-2010 the Libav developers
[..]
Input #0, mpegts, from 'input.mts':
  Duration: 00:01:52.19, start: 0.500000, bitrate: 13552 kb/s
  Program 1
    Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR
16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
    Stream #0.2[0x1200]: Subtitle: pgssub

I want to extract the subtitles in stream 0.2 as images, ideally as a
"burned in" overlay of the video-thumbnails.

What I tried:

ffmpeg -i input.mts -map 0.2 -an -vn -f image2 -r 1/10 out%d.jpg
-->
Output #0, image2, to 'out%d.jpg':
Output file #0 does not contain any stream

ffmpeg -i input.mts -an -vn -scodec xsub  -f rawvideo out

Output #0, rawvideo, to 'out':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0: Subtitle: xsub
Stream mapping:
  Stream #0.2 -> #0.0
Press [q] to stop encoding
[xsub @ 0x9cab10]No more than 4 subtitle colors supported (256 found.)
[xsub @ 0x9cab10]Color index 0 is not transparent. Transparency will
be messed up.
[xsub @ 0x9cab10]Time code >= 100 hours.
Subtitle encoding failed


Thanks,

Benedict


More information about the ffmpeg-user mailing list