Avidemux Forum

Avidemux => Windows => Topic started by: Photoman15 on September 30, 2016, 01:59:44 PM

Title: Command Line Question
Post by: Photoman15 on September 30, 2016, 01:59:44 PM
I want to simply take an (x.264) MKV and make it an .MP4 in a command line (so I can batch it). (preferably not Python)
The only setting I change is the OUTPUT FORMAT (and I change to Streaming Optimization, but not vital).
Here is an example:
(https://avidemux.org/smif/proxy.php?request=http%3A%2F%2Fwww.cdphotography.com%2F55%2Favid.jpg&hash=345b44432fb48c9f1cf008a50bd745a54524dd6e)
Title: Re: Command Line Question
Post by: mean on September 30, 2016, 05:29:48 PM
Save a project file and just keep the 2 lines as yourscript.py
i.e. something like

adm=Avidemux()
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")

and do
avidemux_cli --load yourinputfile.mkv --run yourscript.py --save yourouput.mp4 --quit

Other method

avidemux_cli --load yourinputfile.mkv --output-format MP4 --save yourouput.mp4 --quit
Title: Re: Command Line Question
Post by: Photoman15 on September 30, 2016, 09:39:58 PM
Here's what I have in a bat file:

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
for %%f in (*.mkv) do %avidemux% --load "%%f" --run pui.py --save "%%f.mp4" --quit

This is what I have in a save .py file:
adm=Avidemux()
adm.setContainer("MP4V2", "muxerType=0" "optimize=1", "useAlternateMp3Tag=True")

It reads the input file (.mkv) then an INFO dialog box pops up and says:
MUXER
Cannot Open

Any advice?

Thank you
Title: Re: Command Line Question
Post by: dosdan on October 01, 2016, 12:43:17 AM
Quote from: Photoman15 on September 30, 2016, 09:39:58 PM
Here's what I have in a bat file:

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
for %%f in (*.mkv) do %avidemux% --load "%%f" --run pui.py --save "%%f.mp4" --quit


--save "%%f.mp4"   will save TEST.MKV as TEST.MKV.MP4.  You'll need something like "%%~nf.mp4" if you wish to save the file as TEST.MP4

The err msg you've received from ADM is not very imformative.  Perhaps there is more info in %appdata%\avidemux\admlog.txt

It will probably be simpler to do it all in a FFMPEG batch file, (at least with FFMPEG you can use -loglevel debug to get a better idea of what's going on) , and drag-and-drop one or more MKVs onto this icon.


Convert_MKV_to_MP4.bat (This version can handle a filename with a dash in it.)

@echo off

cls
set filename=""

:FILES_LOOP
for %%F in (%1) do (
set filename=%%F 
echo Processing %%F
ffmpeg.exe -i %%F -c:v copy -c:a copy  -y -hide_banner -loglevel error "%%~nF.mp4"

if errorlevel 1 goto ERROR_OCCURRED
dir "%%~nF.mp4" | find "/"
rem Remove REM from the start of the next line if you wish to delete the original file if no error occured in the conversion.
REM del %%F
echo.
shift
)
if not "%1"=="" goto FILES_LOOP
goto FINISHED

:ERROR_OCCURRED
echo.
echo An error occured when trying to process %filename%
echo Aborting...

:FINISHED
echo.
echo.
pause



Dan.