Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
926 views
in Technique[技术] by (71.8m points)

ffmpeg - Convert compressed swf to mp4

I'm looking for a batch script to convert swf to mp4, lossless. I tried using both ffmpeg and handbrake, but apparently swf is compressed and I can't convert them this way.

ffmpeg -i input -c:v libx264 -preset ultrafast -qp 0 output.mkv

HandBrakeCLI -i source -o destination

I know I acn use a tool like xilisoft, but I've more than 3000 videos and would need to run this automatically. Is there a script/ algorithm that can help me automate this process?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Get gnash:

git clone git://git.sv.gnu.org/gnash.git

You'll need a bunch of dependencies before you can build it (should be able to apt-get them all):

libsdl-dev
libboost-dev
libagg-dev

Then configure and build the gnash video dumper:

cd gnash

./autogen.sh

./configure --enable-renderer=agg 
               --enable-gui=dump 
               --disable-menus 
               --enable-media=ffmpeg 
               --disable-jemalloc

make

you can then point dump-gnash at a swf and it will render out the raw video and audio

dump-gnash -1 
                   -D /tmp/out.raw@30 
                   -A /tmp/out.wav                       
                   -P "FlashVars=myURL=http://example.com/blah&online=true" 
                   http://example.com/blah/some.swf 

This will write out /tmp/out.raw (which is bgra aka rgb32 video) at 30fps (the @30 bit) and /tmp/out.wav

These need re-combining into e.g. mp4 using:

ffmpeg -i /tmp/out.wav 
       -f rawvideo 
       -pix_fmt rgb32 
       -s:v 800x550 
       -r 30 
       -i /tmp/out.raw 
       -c:v libx264 
       -r 30 
       -b 160k 
       /tmp/out.mp4

because its raw video, ffmpeg needs to know colourspace (rga32) dimensions and input fps. We tell it to combine the audio (160kbps mp3), render the video back out at 30fps

You'll need additional flags to get the lossless mp4.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...