Convert swf file to mp4 using ffmpeg

假装没事ソ 提交于 2019-12-12 09:10:03

问题


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?


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/33151918/convert-swf-file-to-mp4-using-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!