I have a python script which loads an MP4 file and saves the audio to an OGG file like so:
movie = AudioSegment.from_file(f"movie.mp4", format="mp4")
movie.export(f"audio.ogg", format="ogg")
I want to extract that to a bash script which will run once at the we create our Debian packages. To do so, I prefer bash and no python. Is the following command equivalent?
ffmpeg -i movie.mp4 -vn audio.ogg
It seems to work (the audio sounds the same), but I wanted to make sure that it was as close as possible to the original conversion. The resulting files can't just be compared apparently.
ffmpeg -i movie.mp4 -vn audio.ogg
Yes, this will convert the audio in the MP4 to Vorbis audio and put it in OGG container.
Video will be ignored due to -vn
.
This assumes your ffmpeg
was compiled with --enable-libvorbis
(it is commonly enabled for distributed ffmpeg packages, such as from your distro). If it's not then ffmpeg
will fallback to the native, built-in FLAC encoder. You can prevent this by adding the -c:a libvorbis
output option, and it will instead fail if libvorbis is not available.