Last active
January 7, 2019 09:20
-
-
Save darkcolonist/ff6d1a8022be08765686e6a51729ac32 to your computer and use it in GitHub Desktop.
send to mp4 (convert to mp4) using ffmpeg (src: https://superuser.com/a/440639). tested with mkv to mp4 and avi to mp4 conversions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
rem *********************************************************************** | |
rem * MOV to MPG batch converter. (2014-09-29 Sinx) * | |
rem * * | |
rem * For installation just copy batch file to SendTo directory. * | |
rem * On Win8 execute "SHELL:sendto" to go to Sendto folder. * | |
rem * * | |
rem * I got quite good compression rations with these parameters: * | |
rem * vcodec=h264 codec used * | |
rem * vb=10000 video bandwidth * | |
rem * deinterlace=1 rebuild full pictures from keyframes and diffs. * | |
rem * acodec=mp3 audio codec * | |
rem * ab=128 128kbps mp3 quality * | |
rem * channels=2 stereo * | |
rem * * | |
rem * for parameters see * | |
rem * http://www.videolan.org/doc/vlc-user-guide/de/ch04.html * | |
rem *********************************************************************** | |
echo ********************************************************************** | |
echo MOV to MPG VLC batch converter called: %0 %1 %2 %3 %4 %5 %6 %7 %8 | |
echo ********************************************************************** | |
echo. | |
echo For installation, just copy batch file to SendTo folder.. | |
echo. | |
SET _new_extention=mp4 | |
:start | |
if "%~1"=="" (call goto :the_end) | |
CALL :SUB_CONVERT %1 | |
SHIFT | |
goto :start | |
:SUB_CONVERT | |
SET _orig_path=%~1 | |
rem SET _orig_extention=%_orig_filename:*.=% | |
echo %_orig_path% | |
SET _orig_extention=%_orig_path:*.=% | |
CALL SET _new_path=%%_orig_path%:.%_orig_extention%=.%_new_extention%%% | |
set _new_path="%_new_path%" | |
echo. | |
echo Converting %1 ======TO===== %_new_path% ... | |
echo. | |
rem if exist "%ProgramFiles%\VideoLAN\VLC\vlc.exe" ( | |
rem SET _vlc_path="%ProgramFiles%\VideoLAN\VLC\vlc" | |
rem ) else ( | |
rem SET _vlc_path="%ProgramFiles(x86)%\VideoLAN\VLC\vlc" | |
rem ) | |
rem vlc implementation | |
rem SET _vlc_path="D:\Program Files\VideoLAN\VLC\vlc.exe" | |
rem CALL %_vlc_path% -I dummy -vvv %1 --sout=#transcode{vcodec=h264,vb=10000,deinterlace=1,acodec=mp3,ab=128,channels=2,samplerate=44100}:standard{access=file,mux=ts,dst=%_new_path%} vlc://quit | |
rem ffmpeg implementation | |
SET _ffmpeg_path="D:\Program Files\ffmpeg-20190105-2d580d7-win64-static\bin\ffmpeg.exe" | |
IF /I "%_orig_extention%"=="mkv" ( | |
CALL %_ffmpeg_path% -i %1 -c:v copy -c:a copy %_new_path% | |
rem echo %_orig_extention% IS mkv | |
rem pause | |
) ELSE ( | |
CALL %_ffmpeg_path% -i %1 %_new_path% | |
rem echo %_orig_extention% is NOT mkv | |
rem pause | |
) | |
GOTO :eof | |
:the_end | |
echo ********************************************************************** | |
echo * FINISHED * | |
echo ********************************************************************** | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
right-click an mkv file... not tested with other video formats... could also fail if not a valid video.
also make sure that there's only one dot (.) in the file name so that the batch file can find the extension easily
