[FFmpeg-user] Extracting images from swf using ffmpeg (version 8 swf vs version 10)

Ryder Wright iltlwp at gmail.com
Sun Oct 9 21:54:37 EEST 2016


Wow, thanks for the fast response Moritz!


> Apparently ffmpeg can't correctly decode/demux the version 10 SWF file.
> Please show us the complete, uncut console output of the above command.
>

I believe I've found a way to address my problem (posted separately), but
I'd be interested in learning more about how the full log can help debug
this issue.  Here's the full output:

% ffmpeg -i b.swf -f image2 -vcodec png -r 30 j%02d.png
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl
--enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx
--disable-decoder=libvpx --enable-libmp3lame --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-avfilter
--enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters
--enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc
--arch=x86_64 --enable-runtime-cpudetect
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[swf @ 0x7fb6b9804600] SWF compressed file detected
b.swf: could not find codec parameters


For comparison, here's the output for a version 8 SWF file (a.swf):

% ffmpeg -i a.swf -f image2 -vcodec png -r 30 i%02d.png
ffmpeg -i a.swf -f image2 -vcodec png -r 30 i%02d.png
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl
--enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx
--disable-decoder=libvpx --enable-libmp3lame --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-avfilter
--enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters
--enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc
--arch=x86_64 --enable-runtime-cpudetect
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[swf @ 0x7fdf6b002000] SWF compressed file detected
Input #0, swf, from 'a.swf':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: vp6f, yuv420p, 480x320, 30 fps, 30 tbr, 30 tbn
Output #0, image2, to 'i%02d.png':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: png, rgb24, 480x320, q=2-31, 200 kb/s, 30 fps, 30
tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.60.100 png
Stream mapping:
  Stream #0:0 -> #0:0 (vp6f (native) -> png (native))
Press [q] to stop, [?] for help
frame=   31 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.03 bitrate=N/A
video:6278kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown

In addition to the above output, k01.png, k02,png, ... k31.png are created,
as desired (for version 8, but not version 10).


> > No shapes, just a single MovieClip (and a Font).
>
> Can you share a sample?
>

I didn't do so initially because the swf files are NSFW and I didn't want
to offend anyone's sensibilities ;-)
I can share under separate cover if it is useful.

>    - Why does one specify a format type of 'image2' (as opposed to 'swf'
> or
> >    'avm2')?
>
> You don't have to; if you give "something%d.jpg" with a recognized
> image extension, them image2 demuxer for said image format is
> automatically chosen.
>

Ah, that makes sense.

As an aside, just for my own curiosity, a question about the -f flag.  From
the manual:

-f fmt (*input/output*)

Force input or output file format. The format is normally auto detected for
input files and guessed from the file extension for output files, so this
option is not needed in most cases.

How does one specify an input format and an output format with the same
flag (-f)?

When would one need to specify a format of 'swf'?  How about 'avm2'?  I was
initially thinking maybe the difference between version 8 and version 10
was that version 8 was using 'swf' and version 10 was using 'avm2'.


> That format specifies that a series of single images is to be output
> (instead of e.g. just one image).
>

Makes sense.


> Moritz
>

Sincerely appreciation the response Moritz ... thanks!
Ryder


More information about the ffmpeg-user mailing list