Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks.
Below is a DOS command line script to process multiple video on multiple level of directories.
Create a test.bat near the folder has the videos you want to convert, the converted files will be near source videos.
ref how to .py script - http://aldoniel.free.fr/calepindugeek/Batch-processing-of-multiple-video.html
before :
ref - batch files IDE
ffmpeg
batch convert all folders that contain .mp4 files
the batch file has to be on the root folder has sub-folders with .mp4 files. The default setting is to scale it to 480p.
Below is a DOS command line script to process multiple video on multiple level of directories.
Create a test.bat near the folder has the videos you want to convert, the converted files will be near source videos.
JavaScript:
@echo off
REM https://stackoverflow.com/a/9681923/1320686
REM cmd expands variables when commands are parsed, not when they are run. Stick a setlocal enabledelayedexpansion at the start. Use instead of %var% the !var!
setlocal enabledelayedexpansion
REM which file extension dir command will try to find
set sorce_file_extenion=wmv
REM expected destination format extension
set destination_file_extenion=mp4
REM where avidemux exists
set avidemux="C:\Program Files\Avidemux\avidemux.exe"
REM these variables dont take place when using py_script [START]
set videocodec=x264
set audiocodec=Copy
set video_container=MP4
REM MATROSKA / MP4 / Copy
REM these variables dont take place when using py_script [END]
REM if py script defined ignore the above
set py_script=""
REM %~dp0 gets the batch file location
rem set output_folder=%~dp0\!converted
REM Create output folder if doesnt exists
rem if not exist "%output_folder%" mkdir %output_folder%
REM foreach file in folder & subfolders
FOR /F "usebackq delims==" %%f in (`dir *.%sorce_file_extenion% /s /b`) do (
REM assing item properties to variables nf xf pf ff beause we set %%f, if was %%I will be nI xI pI fI
set file_wo_ext=%%~nf
set fileext=%%~xf
set file_folder=%%~df%%~pf
set full_pathfile=%%~ff
set test=%%f
set destination_pathfile=!file_folder!!file_wo_ext!.!destination_file_extenion!
REM if file exists aka when converting to the same video format, merge current datetime to filename
if exist "!destination_pathfile!" (
@call :GetDateTime now
set destination_pathfile=!file_folder!!file_wo_ext!!now!.!destination_file_extenion!
)
echo Processing %%f
IF %py_script%=="" (
@call :RunJob "%%f" "!destination_pathfile!"
) ELSE (
@call :RunJobwScript "%%f" "!destination_pathfile!"
)
)
goto the_end
REM ref - https://stackoverflow.com/a/19729941/1320686
REM https://stackoverflow.com/a/6728702/1320686 - eof return to the caller!!
:GetDateTime
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
@set %1=%mydate%_%mytime%
goto :eof
:RunJob
%avidemux% --output-format %video_container% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load %1 --save %2 --quit
goto :eof
:RunJobwScript
%avidemux% --load %1 --run %py_script% --save %2 --quit
goto :eof
:the_end
echo Process ended at %date%%time%
ref how to .py script - http://aldoniel.free.fr/calepindugeek/Batch-processing-of-multiple-video.html

before :
JavaScript:
#PY <- Needed to identify #
#--automatically built--
adm = Avidemux()
adm.loadVideo("C:/Users/user1/Documents/LMDMF/FRED.ET.CIE.(LMDMF).mp4")
adm.clearSegments()
adm.addSegment(0, 0, 743440000)
adm.markerA = 0
adm.markerB = 743440000
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280")
[/py]
after :
[py]
#PY <- Needed to identify #
#--automatically built--
adm = Avidemux()
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280")
ref - batch files IDE
ffmpeg
batch convert all folders that contain .mp4 files
the batch file has to be on the root folder has sub-folders with .mp4 files. The default setting is to scale it to 480p.
JavaScript:
@echo off
::takes the value of variables that were modified inside IF or FOR commands by enclosing their names in exclamation-marks
setlocal enabledelayedexpansion
:: filepath of ffmpeg
set ffmpeg="J:\tools\ffmpeg.exe"
::output folder name
set output=+converted
::%~dp0 gets the batch file location concat with user output folder name
set output_folder=%~dp0%output%\
::FOR EACH FOLDER
for /F "delims=" %%D in ('dir /a:d /b /d') do (
if "%%D" NEQ "%output%" (
::Directory name
set folder=%%D
::Full path
set fullpath=%%~dD%%~pD
::CONCAT with FOR folder name
set ff=!fullpath!!folder!
REM batch files can't have nested loops, the solution for use !ff! variable, is to pass it to a subroutine!
@call :SUB "!ff!" "!folder!"
)
)
pause
:SUB
set destination_folder=!output_folder!%~2
for /R "%~1" %%r IN (*.mp4) do (
REM Create folder if doesn't exist
if NOT exist "!destination_folder!" (
mkdir "!destination_folder!"
)
@call :RunJob "%%r" "!destination_folder!\%%~nr%%~xr"
)
goto :EOF
:RunJob
REM https://trac.ffmpeg.org/wiki/Scaling
REM https://stackoverflow.com/a/43435732 + https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate
REM https://superuser.com/a/1045060
echo.
echo Processing %~1
%ffmpeg% -hide_banner -loglevel error -i "%~1" -vf scale=854:-1 "%~2"
goto :EOF