FfmpegandAudio: Difference between revisions
Andrecastro (talk | contribs) (Created page with "==Audio transcoding with ffmpeg== ===mp3 to ogg=== ogg/Vorbis audio files (Vorbis codec; ogg file-format) are quite important, not only it is an open-source format, but also fi...") |
Andrecastro (talk | contribs) No edit summary |
||
Line 71: | Line 71: | ||
Source: http://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata ffmpeg and metadata | Source: http://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata ffmpeg and metadata | ||
[[Category:Cookbook]] |
Revision as of 17:52, 16 January 2012
Audio transcoding with ffmpeg
mp3 to ogg
ogg/Vorbis audio files (Vorbis codec; ogg file-format) are quite important, not only it is an open-source format, but also firefox requires ogg format in its <audio> Quality seems quite good (better than mp3 when compressed from a uncompressed audio format: flac, wav or aiff, so it says)
ffmpeg -i input.mp3 -acodec libvorbis -ab 128k output.ogg
- explained:
- -acodec libvorbis use vorbis codec
- -ab 128k convert output to 128kbits/sec bit-rate alternatively can use -aq 60 which means audio quality is 60 (~160 kbits/sec)
good information on ffmpeg transcoding: http://howto-pages.org/ffmpeg/#basicaudio
Here is a small script to turn all the .mp3 on the directory to .ogg
#! /bin/sh
ext=".mp3"
target="ogg"
for n in *.mp3
do
base=$(basename $n $ext) #to extract only the filename and NOT the extension
ffmpeg -i $n -acodec libvorbis -ab 128k $base.$target
done
#Script ends here
wma to ogg
to get reed of those annoying wma files
ffmpeg -i infile.wma -vn -acodec libvorbis -ab 128k outfile.ogg
Adding metadata to mp3 files
unfortunately metadata doesn seem possible to be added to ogg files with ffmpeg
ffmpeg -i infile.mp3 -metadata author="the author name" -metadata title="the title" -acodec copy outputfile.mp3
#! /bin/sh
# adds metadata to all .mp3 files of the directory the script is located
# it employs the file name as the song's title
ext=".mp3"
for n in *.mp3
do
base=$(basename $n $ext) #to extract only the filename and NOT the extension
ffmpeg -i $n -metadata author="YOUR NAME" -metadata title=$base -acodec copy $base$ext
done
Source: http://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata ffmpeg and metadata