Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to extract a single frame from a video, with subtitles, using ffmpeg.

I built ffmpeg myself:

sircmpwn@picard ~/sources/bakabt-staging/hennkeo/groups $ ffmpeg
ffmpeg version N-54036-g6c4516d Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 15 2013 11:56:01 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/sircmpwn/ffmpeg_build --extra-cflags=-I/home/sircmpwn/ffmpeg_build/include --extra-ldflags=-L/home/sircmpwn/ffmpeg_build/lib --bindir=/home/sircmpwn/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 35.101 / 52. 35.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

And I run this:

sircmpwn@picard ~/sources/bakabt-staging/hennkeo/groups $ ffmpeg -ss 00:09:18 -i horrible.mkv -sn -vf ass=horrible.ass -t 1 -vframes 1 horrible-1.png
ffmpeg version N-54036-g6c4516d Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 15 2013 11:56:01 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/sircmpwn/ffmpeg_build --extra-cflags=-I/home/sircmpwn/ffmpeg_build/include --extra-ldflags=-L/home/sircmpwn/ffmpeg_build/lib --bindir=/home/sircmpwn/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 35.101 / 52. 35.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from 'horrible.mkv':
  Metadata:
    creation_time   : 2013-05-26 13:34:41
  Duration: 00:23:42.11, start: 0.000000, bitrate: 1900 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 30.30 fps, 30.30 tbr, 1k tbn, 59.94 tbc (default) (forced)
    Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp (default) (forced)
    Stream #0:2: Subtitle: ssa (default) (forced)
Codec 0x18000 is not in the full list.
    Stream #0:3: Attachment: unknown_codec
    Metadata:
      filename        : OpenSans-Semibold.ttf
      mimetype        : application/x-truetype-font
[Parsed_ass_0 @ 0x3521780] Added subtitle file: 'horrible.ass' (9 styles, 374 events)
Output #0, image2, to 'horrible-1.png':
  Metadata:
    encoder         : Lavf55.8.102
    Stream #0:0: Video: png, rgb24, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 30.30 tbc (default) (forced)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> png)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.03 bitrate=N/A dup=0 drop=57    
video:364kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.005907%

Which gives me this image. The desired image is something like this one.

share|improve this question

Alright, answer was found on #ffmpeg IRC. The problem was the ordering of arguments (unsuprisingly). The correct invocation is:

ffmpeg -i horrible.mkv -ss 00:09:18 -vf ass=horrible.ass -vframes 1 horrible-1.png

I ran into a second problem with fonts, that you might share. ffmpeg won't use fonts from the media you give it, so you first have to install them to your system. I modified a script I was given on IRC that extracts fonts from video files into ~/.fonts for you: https://gist.github.com/SirCmpwn/5789762

share|improve this answer
    
Considering adding usage of embedded fonts as a feature request on the FFmpeg Bug Tracker, or submit a patch to implement this to the ffmpeg-devel mailing-list if interested. – LordNeckbeard Jun 16 '13 at 1:27

Your command has -sn. -sn basically means "no subtitles". ffmpeg is behaving expectedly.

Search for -sn on the documentation.

Your solution doesn't have -sn.

I may be completely off but this is likely what fixed your first issue.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .