Author Topic: Command Line Question  (Read 1588 times)

Photoman15

  • Newbie
  • *
  • Posts: 2
Command Line Question
« 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:

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10967
Re: Command Line Question
« Reply #1 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
Code: [Select]
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

Photoman15

  • Newbie
  • *
  • Posts: 2
Re: Command Line Question
« Reply #2 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

dosdan

  • Full Member
  • ***
  • Posts: 131
Re: Command Line Question
« Reply #3 on: October 01, 2016, 12:43:17 AM »
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.)

Code: [Select]
@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.
« Last Edit: October 01, 2016, 12:48:02 AM by dosdan »