0

So I have been trying for days to work out how to do this and this site has helped me but I am still stuck.

I basically want to run a batch file and it goes through a folder including all subdirectories and changes the container of all mkv files to mp4 converting the sound to AAC if necessary. Preferably it will create the new mp4 file in the same place with the same name and then delete the mkv.

All I have so far is this which if I place it in a certain folder will create the mp4's in a specified folder called newfiles. I am not sure if I have used libfaac correctly either. Would greatly appreciate any advice. I would have liked to use libfdk_aac but I have tried everything to get it and I cant find it.

for %%a in ("*.mkv") do C:\ffmpeg\bin\ffmpeg -i "%%a" -vcodec copy -acodec libfaac "Z:\newfiles\%%~na.mp4"
pause

1 Answers1

1

Try this for variable bit rate (VBR):

for %%a in (*.mkv) do C:\ffmpeg\bin\ffmpeg -i "%%~a" -vcodec copy -c:a libfaac -q:a 100 "%%~na.mp4"
pause

Range for -q:a is 10-500 and is similar to using the -q option in standalone faac. 100 is a good value to try.


or try this for average bit rate (ABR):

for %%a in (*.mkv) do C:\ffmpeg\bin\ffmpeg -i "%%~a" -vcodec copy -c:a libfaac -b:a 192k "%%~na.mp4"
pause

FFmpeg and AAC Encoding Guide: libfaac

Note that you will not get as good results as with libfdk_aac. The license of libfdk_aac is not compatible with the GPL, so the GPL does not permit distribution of binaries containing code licensed under these licenses when GPL-licensed code is also included. Therefore this encoder has been designated as "non-free", and you cannot download a pre-built ffmpeg that supports this. This can be resolved by compiling ffmpeg yourself. You can do this for example with the help of this project.

Endoro
  • 37,015
  • 8
  • 50
  • 63
  • Thanks that has really helped with the audio. I've worked out from someone else you helped here [link](http://stackoverflow.com/questions/16141869/ffmpeg-batch-convert-subfolders) that /r can search through folders. Just trying to adjust that script to fit my needs now. – TechnicPuppet Feb 28 '15 at 08:44