Resource icon

[Guide] Batch convert FLV to MP4 losslessly with FFMPEG

Hi my friends,

U need to create a batch file, just like the other guide. There are 2 versions of the script, one which u hardcode the paths inside it and the other one that asks for user input. Both of them search all the files in the directory and convert each file one after the other as long as no errors are thrown from FFMPEG.

Download the ffmpeg executable (the statically linked one so it has what it needs in 1 file) and paste it inside your system32 folder so it can execute from everywhere.

this is the version that u have to edit the paths inside the script everytime, the path can have spaces as you can see in the code too:

Code:
@echo off
echo =========================================
echo Flv to Mp4 batch script using ffmpeg v1.0
echo =========================================
echo.
echo Press any key to start the batch process
pause>nul
set SourceDir=C:\Example Dir Here
set TargetDir=C:\Example Dir Here
cd /d %SourceDir%
for %%f in (*.flv) do ffmpeg -i "%SourceDir%\%%f" -c copy -copyts "%TargetDir%\%%f.mp4"
echo.
echo All done! Press any key to exit...
pause>nul



this is the version that will ask for user input:
Code:
@echo off
echo =========================================
echo Flv to Mp4 batch script using ffmpeg v1.0
echo =========================================
echo.
set /p SourceDir= "Enter the source directory -> "
echo Ok, SOURCE set as %SourceDir%
set /p TargetDir= "And now the target directory -> "
echo TARGET set as %TargetDir%
echo.
echo Press any key to start the batch process
pause>nul
cd /d %SourceDir%
for %%f in (*.flv) do ffmpeg -i "%SourceDir%\%%f" -c copy -copyts "%TargetDir%\%%f.mp4"
echo.
echo Done, press any key to exit...
pause>nul

Theoretically by changing the extension in the scripts you can convert other types of files too, as long as the codec can exist in both the input and output container.

I still can't believe there isn't a freeware program with GUI that can do this stuff and we have to resort to the commandline lol
Author
sepultribe
Views
9,430
First release
Last update
Rating
5.00 star(s) 1 ratings

Latest updates

  1. fixed a minor issue

    Fixed a mistake I had in the CD command, I had forgotten the /d switch, so the scripts would...

Latest reviews

awesome, I put the bat into the same folder like my flv files. I added the path from where the ffmpeg ist stored into the environment variable of windows (path) and it works :) thx
Top