Ubuntu 7.10 : ffmpegで「flv」形式の動画を「mp4」形式に変換します。
mohamed_hassan / Pixabay
1)インストール
$ sudo apt-get build-dep ffmpeg $ sudo apt-get install liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev $ svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg $ ./configure ¥ --enable-gpl ¥ --enable-pp ¥ --enable-libvorbis ¥ --enable-liba52 ¥ --enable-libgsm ¥ --disable-debug ¥ --enable-libmp3lame ¥ --enable-libfaad ¥ --enable-libfaac ¥ --enable-pthreads $ make $ sudo make install
2)確認
$ which ffmpeg /usr/local/bin/ffmpeg $ ffmpeg -version FFmpeg version SVN-r11513, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-gpl --enable-pp --enable-libvorbis --enable-liba52 --enable-libgsm --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-pthreads libavutil version: 49.6.0 libavcodec version: 51.49.0 libavformat version: 52.3.0 libavdevice version: 52.0.0 built on Jan 12 2008 14:00:56, gcc: 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2) FFmpeg SVN-r11513 libavutil 3212800 libavcodec 3354880 libavformat 3408640 libavdevice 3407872
3)変換
MPEG4 QVGA/標準画質
Video: MPEG4 320×240 600kb/s
Audio: AAC 44.100kHz 128kb/s
$ ffmpeg -i input.flv -vcodec mpeg4 -s 320x240 -r 23.976 -b 600k -acodec libfaac -ac 2 -ar 44100 -ab 128k output.mp4
4)スクリプト化
$ vi flv2mp4.sh #!/bin/sh file=`basename $1` filename=${file%.*} ffmpeg -i $1 -vcodec mpeg4 -s 320x240 -r 23.976 -b 600k -acodec libfaac -ac 2 -ar 44100 -ab 128k ${filename}.mp4 exit 0 $ chmod +x flv2mp4.sh $ ./flv2mp4.sh FLVファイル
以上