News:

--

Main Menu

2.6.3 crashing when run batch file.

Started by Bassquake, April 11, 2013, 07:39:23 PM

Previous topic - Next topic

Bassquake

Hi.

Thanks for great program. Now to the problem Im having!

Ive been trying to get a bat file to run but when AVIDemux opens it instantly crashes.

The code to the bat file is:

Quoteset avidemux="C:\Program Files (x86)\Avidemux 2.6\avidemux.exe"
set audiocodec=LavAAC
set videocodec=Copy
set container=MP4
for %%f in (*.MOV) do %avidemux% --output-format %container% --audio-codec %audiocodec% --video-codec %videocodec% --load "%%f" --save "%%~nf.mp4" --quit

I just want to convert the mov files in a folder to mp4, keeping the video stream and convert the audio to AAC.

And here's the crash report:

QuoteProblem signature:
  Problem Event Name:   APPCRASH
  Application Name:   avidemux.exe
  Application Version:   2.6.3.8518
  Application Timestamp:   51514c53
  Fault Module Name:   StackHash_e98d
  Fault Module Version:   0.0.0.0
  Fault Module Timestamp:   00000000
  Exception Code:   c0000005
  Exception Offset:   01451d22
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:   2057
  Additional Information 1:   e98d
  Additional Information 2:   e98dfca8bcf81bc1740adb135579ad53
  Additional Information 3:   6eab
  Additional Information 4:   6eabdd9e0dc94904be3b39a1c0583635

Im running on Windows 7 64 bit. It works fine when do this manually in AVIDemux itself, I open the video and set the settings and export. It just crashes with the batch file.

I tried the 2.6.1 64bit version but the audio settings wont get changed, you have to manually set it in the GUI. It doesnt crash though.

Help appreciated!  :D

Edit: I already disabled and tried different OpenGL settings in the preferences to no avail.

mean

Please try the new build; see above post

Bassquake

Cool the avidemux_2.6.3_r8558_win32 doesn.t crash running the bat.  ;D

But im still getting an error popup in AVIDemux, saying "Unsupported. Only AAC & mpegaudio supported for audio". The next popup says "Muxer. Cannot open".

I've set the audiocodec in the bat yet its not setting it. Is there a different syntax?

mean

Make sure you have only one track of the right kind
(or several tracks of the right kind)

If you are using mp4v2 as muxer it may crash

Bassquake

Theres only 1 audio track in the video. (Its video from a Canon Ixus 220HS).

I need to convert the originals pcm audio to aac. Like I say, it works if I open the video in avidemux and select the LibAAC for the audio properties. Its like AVIDemux is ignoring the settings in the batch file.

Im using the mp4 muxer.

Bassquake

Finally got the batch to work after much faffing around!

You need 2 files. One is the batch file which triggers the project py file. Here's how I did it:

Save the code below into a file called mov2mp4.bat:

Quoteset processfolder=MP4
set avidemux="C:\Program Files (x86)\Avidemux 2.6\avidemux.exe"
set myproject="mov2mp4.py"
mkdir %1%processfolder%
for %%f in (*.MOV) do %avidemux% --load "%%f" --run %myproject% --save "MP4\%%~nf.mp4" --quit

This will create a folder called MP4 for the converted files to go into, runs the myproject file then closes avidemux.

Now create a file called mov2mp4.py and put in:

Quote#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
adm.loadVideo("")
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.audioAddTrack(0)
adm.audioCodec(0, "LavAAC", "bitrate=160");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")

Alter any settings you wish to change such as bitrate for the audio or change the container type.

And thats it! Place those 2 files into the folder of your MOV files and run the bat file. You will now have a folder called MP4 with the converted videos.  ;D

mean

you can do the same kind of  thing with a .py project
There is sample script folder in avidemux source containing some examples


Bassquake

I couldnt see how to have a .py project could be applied to a whole folder of multiple videos to convert without using a batch file. Is there another way? It would be better if it could be run from one file rather than 2. Although it is cool to just be able to double click my bat file and away it goes rather than opening avidemux then run project.

I looked at some of the scripts from the source as you suggested but it seems most of them use hardcoded filenames. I wanted to be able to drop a bat file in a folder and let it do its thing.

mean

That one :
http://svn.berlios.de/wsvn/avidemux/branches/avidemux_2.6_branch_mean/autononreg/py/sample_script/remux_ts_2_ps.py

Ask all files in a folder
You can have the script ask for the folder to process

(the script is old, maybe things have changed a bit)

Bassquake

Ill have a look into that.

Just a quick update on my script. I noticed Avidemux crashed if theres no audio in the video file. So heres the updated script which detects if the video has a pcm audio in there and convert the audio as neccessary.

Quote#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
adm.loadVideo("")
adm.videoCodec("Copy")
if(1==adm.audioCodec(0, "PCM")):
   adm.audioClearTracks()
   adm.audioAddTrack(0)
   adm.audioCodec(0, "LavAAC", "bitrate=160")
   adm.audioSetDrc(0, 0)
   adm.audioSetShift(0, 0,0)
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")

I would rather it would detect for any type of audio but I couldnt find a way for it to tell me if a video has an audio stream or not. Im not a coder so any help would be much appreciated.

Bassquake

#10
@mean

I couldnt get that demo script to work. I think youre right in thats its old. Avidemux just throws up errors.

Would be cool to run a project file which would then ask which folder to convert.

Edit: Error I get is:

Exception :(tp_len) TypeError: len() of unsized object

Maestro

I had the same problem for years with Avidemux: refusing to save because audio codec was required to be AAC or mpegaudio. Solution: re-select the AAC audio encoder. Apparently it gets reset without the audio codec dropdown box getting updated with fresh information.

I HOPE THIS GETS BACK TO THE PROGRAMMER OF AVIDEMUX.

Jan Gruuthuse

You should use a saved tinypy project where you have set the audio accordingly to the amount of audio tracks present in the source video (not the amount of channels in a audiotrack).
The project file can be called from cli with --run saved.py
see: 2.6 audio track switching in job.py