Skip to content

Instantly share code, notes, and snippets.

@v-mas
Created January 20, 2018 23:48
Show Gist options
  • Save v-mas/8cd7a6a20b66b7fbccb37701f3a68dd6 to your computer and use it in GitHub Desktop.
Save v-mas/8cd7a6a20b66b7fbccb37701f3a68dd6 to your computer and use it in GitHub Desktop.
batch script to convert mpeg/mov to w10 friendly mp4
@ECHO OFF
REM if mp4a audio is not working
REM Go to Tools > Preferences > Input/Codecs > Video codecs > FFmpeg Changing the 'Strict standard compliance to -2
FOR /R %%G IN (*.mpg) DO (CALL :SUB_VLC_MP4 "%%G")
FOR /R %%G IN (*.mpg.mp4) DO (CALL :SUB_RENAME_MPGMP4 "%%G")
FOR /R %%G IN (*.mov) DO (CALL :SUB_VLC_MOV "%%G")
FOR /R %%G IN (*.mov.mp4) DO (CALL :SUB_RENAME_MOVMP4 "%%G")
PAUSE
GOTO :eof
:SUB_VLC_MP4
SET _firstbit=%1
SET _qt="
CALL SET _newnm=%%_firstbit:%_qt%=%%
SET _commanm=%_newnm:,=_COMMA_%
echo %_commanm%
CALL "C:\Program Files\VideoLAN\VLC\vlc.exe" -I dummy -vvv %1 --sout-ffmpeg-strict=-2 --sout=#transcode{vcodec="h264",acodec="aac",ab="64",deinterlace="1"}:standard{access="file",mux="mp4",dst="%_commanm%.mp4"} vlc://quit
GOTO :eof
:SUB_VLC_MOV
SET _firstbit=%1
SET _qt="
CALL SET _newnm=%%_firstbit:%_qt%=%%
SET _commanm=%_newnm:,=_COMMA_%
echo %_commanm%
CALL "C:\Program Files\VideoLAN\VLC\vlc.exe" -I dummy -vvv %1 --sout-ffmpeg-strict=-2 --sout=#transcode{vcodec="h264",acodec="aac",ab="64"}:standard{access="file",mux="mp4",dst="%_commanm%.mp4"} vlc://quit
GOTO :eof
:SUB_RENAME_MPGMP4
SET _origfnm=%1
SET _endbit=%_origfnm:*.mpg=%
CALL SET _newfilenm=%%_origfnm:.mpg%_endbit%=.mp4%%
SET _newfilenm=%_newfilenm:_COMMA_=,%
COPY %1 %_newfilenm%
DEL %1
GOTO :eof
:SUB_RENAME_MOVMP4
SET _origfnm=%1
SET _endbit=%_origfnm:*.mov=%
CALL SET _newfilenm=%%_origfnm:.mov%_endbit%=.mp4%%
SET _newfilenm=%_newfilenm:_COMMA_=,%
COPY %1 %_newfilenm%
DEL %1
GOTO :eof
:eof
@v-mas
Copy link
Author

v-mas commented Jan 20, 2018

if audio in converted video is not working
Go to Tools > Preferences > Input/Codecs > Video codecs > FFmpeg and change the 'Strict standard compliance' to -2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment