将压缩的swf转换为mp4 [英] Convert compressed swf to mp4
问题描述
我正在寻找一个批量脚本将swf转换为mp4,无损。我尝试使用ffmpeg和handbrake,但显然swf被压缩,我不能以这种方式转换它们。
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
我知道我使用像xilisoft这样的工具,但是超过3000个视频,需要自动运行。有没有脚本/算法可以帮助我自动化这个过程?
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?
推荐答案
获取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
然后配置和构建gnash视频转储器:
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
然后,您可以在一个swf处指定dump-gnash,并将渲染原始视频和音频
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 \
这将写出 /tmp/out.raw
(这是bgra aka rgb32视频)在30fps( @ 30
位)和 /tmp/out.wav
This will write out /tmp/out.raw
(which is bgra aka rgb32 video) at 30fps (the @30
bit) and /tmp/out.wav
这些需要重新组合到例如mp4使用:
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
因为它的原始视频,ffmpeg需要知道colourspace(rga32)维和输入fps。我们告诉它结合音频(160kbps mp3),渲染视频30fps
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
您将需要额外的标志来获得无损的mp4。
You'll need additional flags to get the lossless mp4.
这篇关于将压缩的swf转换为mp4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!