VLCを使用してM4VをMP3にバッチ変換するシェルスクリプト?

VLCを使用してM4VをMP3にバッチ変換するシェルスクリプト?

VLCを使用してM4VビデオファイルディレクトリをMP3オーディオファイルに一括変換したいと思います。 (ffmpegを使っても大丈夫です。)

確立されたbashスクリプトを使用して起動しましたが、スクリプトにどのVLCパラメータを挿入するのかわかりません。

可変ビットレートや64kb/sを使いたいです。サンプリングレートは44100(またはそれ以下)です。私はビデオを出力しないので、VLCにこれらのパラメータが必要かどうかはわかりません。

私のニーズに合わせてこのスクリプトを修正するのに役立つ人はいますか?

#!/bin/sh                                                                                                                                                     

vcodec="mp4v"
acodec="mp4a"
bitrate="1024"
arate="128"
mux="mp4"

vlc="/usr/bin/vlc"                                                                                                                                           

if [ ! -e "$vlc" ]; then
    echo "Command '$vlc' does not exist"
    exit 1
fi

for file in "$@"; do
    echo "=> Transcoding '$file'... "

    dst=`dirname "$file"`
    new=`basename "$file" | sed 's@\.[a-z][a-z][a-z]$@@'`.$mux

    $vlc -I dummy -q "$file" \
       --sout "#transcode{vcodec=mp4v,vb=1024,acodec=mp4a,ab=128}:standard{mux=mp4,dst=\"$dst/$new\",access=file}" \
       vlc://quit
    ls -lh "$file" "$dst/$new"
    echo
done

ベストアンサー1

使用方法ffmpeg

$ ./ffmpeg -i testing.m4v -b:a 192K -vn testing.mp3

または可変ビットレート:

$ ./ffmpeg -i testing.m4v -q:a 0 -map a testing.mp3

ffmpegバージョン

$ ./ffmpeg -version
ffmpeg version N-56896-ga927276
built on Oct  5 2013 05:42:36 with gcc 4.6 (Debian 4.6.3-1)
configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
libavutil      52. 46.100 / 52. 46.100
libavcodec     55. 34.100 / 55. 34.100
libavformat    55. 19.100 / 55. 19.100
libavdevice    55.  3.100 / 55.  3.100
libavfilter     3. 88.101 /  3. 88.101
libswscale      2.  5.100 /  2.  5.100
libswresample   0. 17.103 /  0. 17.103
libpostproc    52.  3.100 / 52.  3.100

引用する

おすすめ記事