There is scope for tightening the code up, for example, a check to make sure at least one argument was provided, and that the BITRATE is not empty before beginning the encode, but as a rough and ready solution this should do fine. Select the output format from 'Profile' and 'Convert' to start to convert the audio file on your computer. Click 'Edit' to adjust the audio volume or click 'Clip' to trim the audio file. REM Encode file using previously captured bitrate Click 'Add File' or drag the video or audio files to this software. SET FFMPEG_PATH=C:\Program Files\ffmpeg-20170807-1bef008-win64-static\binįOR /F "tokens=5 delims=," %%i IN ('""%FFMPEG_PATH%\ffmpeg.exe" -i %INPUT_FILE_FULL_PATH% 2>&1 | find "Audio:""') DO (įOR /F "tokens=1 delims=k" %%j IN ('ECHO %%i') DO (ĮCHO Input file bitrate is !BITRATE! kb/s REM Adjust FFMPEG_PATH variable value to match the path to your FFMPEG binary REM Usage: scriptname.cmd "full-quoted-path-to-input-file" The mp3 output file is created in the same folder as the input file.
This approach was hinted at by the original questioner. This is the standard bitrate for podcasts, and it sounds great on most contemporary devices, including smart speakers and mobile devices. Here is a batch-file solution which captures the input file bitrate and uses that as a parameter for the encoding command line. For music, 64 (AAC)/96 (MP3) kbps is a good general-purpose setting that will sound good most listeners. This should do the trick: sudo apt-get ffmpeg libavcodec-extra-53Īs LordNeckbeard states, using the same bitrate to encode in different formats isn't necessarily wise.
you must install ffmpeg and the extra libav codec package or you're gonna have a bad time. Make sure you install the additional codec package or else it won't work, i.e. Hack it to make it do exactly as you wish or process multiple filetypes to your heart's content.ĮDIT: Just a quick note for anyone on Ubuntu/debian/etc. Just run it in the directory where you have the files like so: $bash script.sh flv # finally, convert to mp3 using proper bitrate # next line gets bitrate of audio from video using ffmpegīit=`ffmpeg -i "$' | cut -d' ' -f1` The output files will be listed in the 'Conversion Results' section. It will automatically retry another server if one failed, please be patient while converting. Click 'Convert Now' button to start batch conversion. The target audio format can be WAV, WMA, MP3, OGG, AAC, AU, FLAC, M4A, MKA, AIFF, OPUS or RA. I can't claim the credit of the key piece of the code, as that goes to the gentleman that writes this blog. Set target audio format, bitrate and sample rate. Here is a bash script that will take a file extension and extract audio from any file with that extension, and of course maintain the bitrate.