I want to convert swf to mp4 using ffmpeg in php ?
Thare are Any particulre script avaible for this ?

Edited by Chirag_97: Spelling Mistake

3 Years
Discussion Span
Last Post by pewaltersgo
Featured Replies
  • 1

    If you have ffmpeg installed you can just use [exec](http://php.net/manual/en/function.exec.php). Read More


I have already install this one ,
But unit i can't convert swf to mp4.H
Here is my script :
ffmpeg -i video.swf -vcodec mpeg4 video.mp4


Do you get any error messages?

exec('fmpeg -i video.swf -vcodec mpeg4 video.mp4', $output);

SWF is not a valid video format. You must obtain the FLV or F4V file before attempting to convert with ffmpeg.

We have successfully converted many Flash videos with both ffmpeg and also the Adobe Media Encoder.

As for SWF, it is a bytecode file to be interpreted by the Tamarin virtual machine (e.g., in a Flash player debugger or plugin).

Regards - Shawn

Edited by pritaeas: Removed url from fake signature. Check the signature option in "Edit Profile".


There is any possibility to convert swf to flv using ffmpeg just because i really need it ?
If any one have any idea then please tell me about this problem as soon as possible .

Edited by Chirag_97: Spelling Mistake


As Pritaeas asked, did you got errors?

Maybe I'm missing a point, but I'm taking some samples from here and it seems I can convert swf files without any problems, both with ffmpeg and avconv:

ffmpeg -i source.swf out.mp4
avconv -i source.swf -b 128k output.mp4

Also you can list supported formats and codecs by using -formats and -codecs:

ffmpeg -formats |grep -i swf
 DE swf             Flash format

ffmpeg -codecs | grep -i swf
 DEA D  adpcm_swf       ADPCM Shockwave Flash

Below each command there is the expected output. Are you using Windows?

Edited by cereal


I got This kind of error.....

C:\Documents and Settings\Administrator> ffmpeg -i 2.swf out.mp4
ffmpeg version N-55922-g454a11a Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 30 2013 18:01:19 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
  libavutil      52. 43.100 / 52. 43.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 15.100 / 55. 15.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.102 /  3. 82.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[swf @ 02c77bc0] SWF compressed file detected
[swf @ 02c77bc0] Estimating duration from bitrate, this may be inaccurate
Input #0, swf, from '2.swf':
  Duration: 00:02:27.68, bitrate: 63 kb/s
    Stream #0:0: Video: rawvideo ([0]RGB / 0x42475200), 0rgb, 2x12, 12 fps, 12 t
br, 12 tbn
    Stream #0:1: Video: mjpeg, yuvj444p, 29x80 [SAR 100:100 DAR 29:80], 12 fps,
12 tbr, 12 tbn
    Stream #0:2: Audio: mp3, 22050 Hz, stereo, s16p, 64 kb/s
[swscaler @ 0025c1c0] deprecated pixel format used, make sure you did set range
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 02c79000] width not divisible by 2 (29x80)
Output #0, mp4, to 'out.mp4':
    Stream #0:0: Video: h264, yuvj420p, 29x80 [SAR 1:1 DAR 29:80], q=-1--1, 90k
tbn, 12 tbc
    Stream #0:1: Audio: aac, 22050 Hz, stereo, s16, 128 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> libx264)
  Stream #0:2 -> #0:1 (mp3 -> libvo_aacenc)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters
such as bit_rate, rate, width or height

Have you tried ffmpeg -i sample.swf sample.mp4?

I also used to use a little piece of software called Faasoft SWF to MP4 Converter to convert SWF to MP4, happy with it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.