7

I need to convert swf files to mp4 files using ffmpeg commands (command line). There is text in swf files which must be converted too. But when I convert files using the following ffmpeg command text in swf file is not converted to mp4 / no text is visible in mp4 file:

ffmpeg -i file.swf video.mp4

Is there any other command to convert text?

Marged
  • 10,577
  • 10
  • 57
  • 99
Hussnain
  • 83
  • 1
  • 1
  • 4
  • After hours of searching, I found this app that does convert .swf to mp4 and html5 with sound and everything in sync and many other formats also in batch: `iDealshare_VideoGo_6.0.6.5638` – Lod Jun 23 '21 at 09:13

2 Answers2

8

I had the same problem. My walk around was to use the raw-output of gnash.

The following bash script summarizes the single steps.

#!/bin/bash

SWFFILE=$1
MP4FILE=${SWFFILE%.*}.mp4
TMPFILE=/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).bin
TMPMP4=/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).mp4

# create raw-dump
GNASHCMD="dump-gnash -1 -r 1 -D $TMPFILE $SWFFILE"
OUTPUT="$(exec $GNASHCMD)"

# extract parameters
WIDTH="$(echo $OUTPUT | grep -o 'WIDTH=[^, }]*' | sed 's/^.*=//')"
HEIGHT="$(echo $OUTPUT | grep -o 'HEIGHT=[^, }]*' | sed 's/^.*=//')"
FPS="$(echo $OUTPUT | grep -o 'FPS_ACTUAL=[^, }]*' | sed 's/^.*=//')"

# create raw, uncompressed mp4 file
mplayer $TMPFILE -vo yuv4mpeg:file=$TMPMP4 -demuxer rawvideo -rawvideo fps=$FPS:w=$WIDTH:h=$HEIGHT:format=bgra

# create compressed mp4 (ffmpeg should work as well)
avconv -i $TMPMP4 $MP4FILE

# clean up
rm -rf $TMPFILE
rm -rf $TMPMP4
skn
  • 169
  • 1
  • 7
6

ffmeg doesn't support shapes and sprites in swf. It can only convert video (Sorenson Spark, VP6), audio (pcm, adpcm, mp3) and images (jpeg) contained in a swf file. You'll have to look for another tool.

aergistal
  • 29,947
  • 5
  • 70
  • 92
  • Thanks for your response! Do you know of any other tool which does the conversion? – Hussnain Oct 15 '15 at 16:08
  • Unfortunately I don't know any 3rd party tool. Adobe Flash had the option to export an animation as a video if I remember correctly. – aergistal Oct 15 '15 at 16:22