My first post so please be gentle! I am totally new to converting videos.
I have spent many, many hours searching for an answer and am now just confused! Please can someone help me.
I am trying to use Avidemux 2.5.6 to batch convert about 1000 AVI home videos from my video camera to MP4 (H.264).
This is where I stand at the moment:
I have worked out my settings I want in Avidemux and saved the project file as avitomp4.js. I deleted the stuff at the beginning of the resulting file after "var app = new Avidemux();" and before "//** Postproc **" relating to the sample video I used to create the project file.
I then Created a "convert avi to mp4.bat" file with the following text:
When I run the .bat file, Avidemux opens, loads the first video in the folder, starts to process it, then crashes.Code:SETLOCAL set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe" for %%f in (*.avi) do (start /w "" %avidemux% --load "%%f" --run avitomp4.js --save "%%f.mp4" --quit) ENDLOCAL
If I load the exact same file manually in Avidemux, then load the project file "avitomp4.js" and save it manually, the video converts perfectly!
I can't work out what I'm doing wrong!
Please can someone point me in the right direction. I thought I had it done right, but I am obviously missing something.
+ Reply to Thread
Results 1 to 30 of 40
-
-
If it helps, here are the contents of my avitomp4.js file:
avitomp4.js:
Code://AD <- Needed to identify// var app = new Avidemux(); //** Postproc ** app.video.setPostProc(3,3,0); app.video.fps1000 = 25000; //** Filters ** app.video.addFilter("YADIF","mode=0","order=1"); //** Video Codec conf ** app.video.codecPlugin("32BCB447-21C9-4210-AE9A-4FCE6C8588AE", "x264", "2PASSBITRATE=9000", "<?xml version='1.0'?><x264Config><x264Options><fastFirstPass>true</fastFirstPass><threads>0</threads><deterministic>true</deterministic><sliceThreading>false</sliceThreading><threadedLookahead>-1</threadedLookahead><idcLevel>-1</idcLevel><vui><sarAsInput>true</sarAsInput><sarHeight>1</sarHeight><sarWidth>1</sarWidth><overscan>undefined</overscan><videoFormat>undefined</videoFormat><fullRangeSamples>true</fullRangeSamples><colorPrimaries>undefined</colorPrimaries><transfer>undefined</transfer><colorMatrix>smpte240m</colorMatrix><chromaSampleLocation>0</chromaSampleLocation></vui><referenceFrames>3</referenceFrames><gopMaximumSize>250</gopMaximumSize><gopMinimumSize>0</gopMinimumSize><scenecutThreshold>40</scenecutThreshold><periodicIntraRefresh>false</periodicIntraRefresh><bFrames>3</bFrames><adaptiveBframeDecision>2</adaptiveBframeDecision><bFrameBias>0</bFrameBias><bFrameReferences>normal</bFrameReferences><loopFilter>true</loopFilter><loopFilterAlphaC0>0</loopFilterAlphaC0><loopFilterBeta>0</loopFilterBeta><cabac>true</cabac><openGop>disabled</openGop><interlaced>disabled</interlaced><constrainedIntraPrediction>false</constrainedIntraPrediction><cqmPreset>flat</cqmPreset><intra4x4Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></intra4x4Luma><intraChroma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></intraChroma><inter4x4Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></inter4x4Luma><interChroma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></interChroma><intra8x8Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></intra8x8Luma><inter8x8Luma><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value><value>16</value></inter8x8Luma><analyse><partitionI4x4>true</partitionI4x4><partitionI8x8>true</partitionI8x8><partitionP8x8>true</partitionP8x8><partitionP4x4>false</partitionP4x4><partitionB8x8>true</partitionB8x8><dct8x8>true</dct8x8><weightedPredictionPframes>smart</weightedPredictionPframes><weightedPrediction>true</weightedPrediction><directPredictionMode>auto</directPredictionMode><chromaLumaQuantiserDifference>0</chromaLumaQuantiserDifference><motionEstimationMethod>multi-hexagonal</motionEstimationMethod><motionVectorSearchRange>24</motionVectorSearchRange><motionVectorLength>-1</motionVectorLength><motionVectorThreadBuffer>-1</motionVectorThreadBuffer><subpixelRefinement>10</subpixelRefinement><chromaMotionEstimation>true</chromaMotionEstimation><mixedReferences>true</mixedReferences><trellis>allModeDecisions</trellis><fastPSkip>true</fastPSkip><dctDecimate>true</dctDecimate><psychoRdo>1</psychoRdo><psychoTrellis>0</psychoTrellis><noiseReduction>0</noiseReduction><interLumaDeadzone>21</interLumaDeadzone><intraLumaDeadzone>11</intraLumaDeadzone></analyse><rateControl><quantiserMinimum>10</quantiserMinimum><quantiserMaximum>51</quantiserMaximum><quantiserStep>4</quantiserStep><maximumConstantRateFactor>0</maximumConstantRateFactor><averageBitrateTolerance>1</averageBitrateTolerance><vbvMaximumBitrate>0</vbvMaximumBitrate><vbvBufferSize>0</vbvBufferSize><vbvInitialOccupancy>0.9</vbvInitialOccupancy><ipFrameQuantiser>1.4</ipFrameQuantiser><pbFrameQuantiser>1.3</pbFrameQuantiser><adaptiveQuantiserMode>variance</adaptiveQuantiserMode><adaptiveQuantiserStrength>1</adaptiveQuantiserStrength><mbTree>true</mbTree><frametypeLookahead>40</frametypeLookahead><quantiserCurveCompression>0.6</quantiserCurveCompression><reduceFluxBeforeCurveCompression>20</reduceFluxBeforeCurveCompression><reduceFluxAfterCurveCompression>0.5</reduceFluxAfterCurveCompression></rateControl><accessUnitDelimiters>false</accessUnitDelimiters><spsIdentifier>0</spsIdentifier><sliceMaxSize>0</sliceMaxSize><sliceMaxMacroblocks>0</sliceMaxMacroblocks><sliceCount>0</sliceCount><hrd>none</hrd></x264Options></x264Config>"); //** Audio ** app.audio.reset(); app.audio.codec("Faac",224,4,"e0 00 00 00 "); app.audio.normalizeMode=0; app.audio.normalizeValue=0; app.audio.delay=0; app.audio.mixer="NONE"; app.setContainer("MP4"); setSuccess(1); //app.Exit(); //End of script
-
I haven't tried to use it, before, but have you tried Avidemux's joblist? You can supposedly do batch work through that.
using:joblist [Avidemux DokuWiki]If cameras add ten pounds, why would people want to eat them? -
Thanks for the suggestion Ai Haibara.
I have looked at that, but unfortunately the joblist requires me to add each file individually and then to run all jobs one after the other as a batch. (unless I'm missing something there too!) So, yes it will work to batch process them all, but adding 1000 odd files individually is just too much hassle! I want something to process them all automatically without having to add each file one at a time.
I think I'm onto the right answer to my problem, but I just can't work out why it won't work.I think I need some expert help with the script or batch file. Do you have any experience with these?
There must be lots of people on this great forum who can do this in their sleep! (I hope!) -
Atak_Snajpera, I had a quick look at Ripbot264, it seems like you have to install and configure an awful lot of software to support it. Is it really good and worth the effort? Silly question, I just found out that it is your software - of course you like it!! It just seems like a lot of hassle to get it all working properly?
Will it process all files in a folder like I want? Or do I have to add them one by one to a joblist?
Does it use x264 for the encoding? Will it read my DV AVI files - It would appear from the link that it is specifically for processing DVD and BD?
I do rather like Avidemux as it is easy to install and get running. I also have done a lot of work setting it up just right to do my batch processing - just can't get the darn batch to run! -
Don't know anything about parameters for avidemux. Never used it.
Try with just the THREE lines in a batch file.
Code:set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe" for %%f in ("*.avi") do %avidemux% --load "%%f" --run avitomp4.js --save "%%~nf.mp4" --quit pause
Last edited by pcspeak; 28th Mar 2012 at 02:03.
-
Thanks pcspeak for the suggestion.
I tried the following:
Code:set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe" set myjob=avitomp4.js for %%f in (*.avi) do %avidemux% --load "%%f" --run %myjob% --save "%%f.mp4" --quit pause
Note, I also changed the variable to "myjob" as someone on the avidemux forum suggested it might not be a good idea to use "script" as a variable.
I assume in your codeCode:--save "%%~nf.mp4"
-
I prefer avidemux to ripbot264 myself ... I don't like installing a bunch of other stuff either.
Have you tried the avidemux forum? It's at:
http://www.avidemux.org/smf/index.php -
Atak_Snajpera, if I don't come right with Avidemux, I will give Ripbot264 a try. Thanks for the tip.
Will it batch process the files like I want?
Hoser Rob - Thanks for the comment. I have posted my problem at the Avidemux forum as well. Found it after posting here. Still struggling to get it to work though.
Both look like great forums and frequented by very knowledgeable and helpful people. I am very new to forums as well and have been taken aback by how helpful everyone is!
Jan Gruuthuse at the Avidemux forum helped me to narrow my problem down to the script. now I'm trying to find the problem with the script - strange that the script runs perfectly manually - just not in a batch. Very confusing!?!
I'm just hoping for a solution from somewhere, anywhere... -
Not a typo.
Will save the output with an MP4 extension and drop the AVI extension.
From Microsoft:
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI- expands %I to a fully qualified path name
%~dI- expands %I to a drive letter only
%~pI- expands %I to a path only
%~nI- expands %I to a file name only
%~xI- expands %I to a file extension only
%~sI- expanded path contains short names only
%~aI- expands %I to file attributes of file
%~tI- expands %I to date/time of file
%~zI- expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
The modifiers can be combined to get compound results:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
environment variable for %I and expands to the
drive letter and path of the first one found.
%~ftzaI - expands %I to a DIR like output line
In the above examples %I and PATH can be replaced by other valid
values.The %~ syntax is terminated by a valid FOR variable name.
Picking upper case variable names like %I makes it more readable and
avoids confusion with the modifiers, which are not case sensitive. -
Thanks!
Will try %%~nf the next time! Always annoyed me that the old extension remained!
Back to Avidemux - I have now found out that Avidemux crashes when trying to save projects involving PCM audio in the original file!! Apparently this has been so for some time and even affects the latest 2.6 builds!
Anyone know anything more on this? Am I mistaken? I did some quick tests and it certainly seems to be true. I can't believe that if this is so, it has remained a bug for so long!
If this is true does anyone know a work around or should I look at other software? -
I use AC3 audio in all my AVI files. Maybe you can adapt my batch file and feed something besides PCM to Avidemux.
This is how I change the input audio, and bump the volume up for my AVI files.
It looks daunting but it isn't hard.
Step 1. FFMpeg to rip the audio from the AVI and save it as an AC3 file.
Step 2. Create Virtualdub JOBS scripts for each AVI.
Step 3. Use Virtualdub to mux the video with the AC3.
It's all quite quick- less than 3 minutes for a 45 minute episode. The video is copied. No changes are made.
I have adapted the batch file to work from same folder for all files.
I may have missed something.
Paths to FFMpeg & Virtualdub need to be changed to suit.
I have 3 hard drives. c:\vid\input-avi, d:\vid\output-ac3, e:\vid\output-avi
This spreads the work load and speeds things up.
Code:for %%a in ("*.avi") do if not exist "%%~na-new.ac3" "c:\vidaud\ffmpeg\ffmpeg.exe" -i "%%a" -acodec ac3 -ac 2 -ab 128k -vol 700 "%%~na-new.ac3" for %%a in ("*.avi") do echo // $signature 0 1 > "%%~na.jobs" for %%a in ("*.avi") do echo // $numjobs 1 >> "%%~na.jobs" for %%a in ("*.avi") do echo // $job "Job 1" >> "%%~na.jobs" for %%a in ("*.avi") do echo // $input "%%~fa" >> "%%~na.jobs" for %%a in ("*.avi") do echo // $output "%%~fna-new.avi" >> "%%~na.jobs" for %%a in ("*.avi") do echo // $state 0 >> "%%~na.jobs" for %%a in ("*.avi") do echo // $id e38e29ba033ff831 >> "%%~na.jobs" for %%a in ("*.avi") do echo // $start_time 00000000 00000000 >> "%%~na.jobs" for %%a in ("*.avi") do echo // $end_time 00000000 00000000 >> "%%~na.jobs" for %%a in ("*.avi") do echo // $script >> "%%~na.jobs" for %%a in ("*.avi") do echo declare frames; >>"%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.Open("%%~da\%%~pa\%%a","",0); >> "%%~na.jobs" for %%a in ("*.avi") do echo frames = VirtualDub.video.length; >>"%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetSource("%%~da\%%~pa\%%~na-new.ac3", ""); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetMode(0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetInterleave(1,500,1,0,0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetClipMode(1,1); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetConversion(0,0,0,0,0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetVolume(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetCompression(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.EnableFilterGraph(0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetInputFormat(0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetOutputFormat(7); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetMode(0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetSmartRendering(0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetPreserveEmptyFrames(0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetFrameRate2(0,0,1); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetIVTC(0, 0, 0, 0); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetCompression(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.filters.Clear(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.filters.Clear(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.subset.Clear(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.subset.AddRange(0,frames); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.video.SetRange(); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.project.ClearTextInfo(); >> "%%~na.jobs" for %%a in ("*.avi") do echo // -- $reloadstop -- >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.SaveAVI("%%~da\%%~pa\%%~na-new.avi"); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.audio.SetSource(1); >> "%%~na.jobs" for %%a in ("*.avi") do echo VirtualDub.Close(); >> "%%~na.jobs" for %%a in ("*.avi") do echo // $endjob >> "%%~na.jobs" for %%a in ("*.avi") do echo // $done >> "%%~na.jobs" pause for %%a in ("*.jobs") do if not exist "%%~na-new.avi" "c:\vidaud\virtualdub\virtualdub.exe" /s "%%a" "%%~na-new.avi" /x :end
-
Na! Forget Virtualdub. Use FFMpeg to create an AAC audio file and mux that in using Avidemux. Will that work? As I said, I've never used Avidemux
Cheers.Last edited by pcspeak; 28th Mar 2012 at 21:07.
-
Using Handbrake. Seems to do what you want.
Install Handbrake. Put this batch file with the AVIs and run it.
HBrake v1.cmd
Code:for %%a in ("*.avi") do "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "%%a" -t 1 -c 1 -o "%%~na.mp4" -f mp4 --strict-anamorphic -e x264 -q 20 --vfr -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0 --gain=0 --audio-copy-mask none --audio-fallback ffac3 -x ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0 --verbose=1
-
Please don't go away! I value all input
I will try alternative programs you suggested if I get nowhere with Avidemux - Thanks for all the ideas and work that went into your suggestions - they will not be ignored! I may just give your Handbrake idea a try tonight anyway - seems simple enough! How did you work out all that - or is it simple once you get into it?
Back to Avidemux - I seem to be getting somewhere. I have been fiddling away and I think I have narrowed it down a bit.
Avidemux crashes when saving a project file without at least configuring the video codec - even if you at least click the configure button and just click Okay - it seems to save the project file without crashing.
The problem I am now bumping into is that as soon as I select 2 pass encoding and try to run the resulting project file from a batch file, Avidemux crashes for each video in the folder! This is even if it runs perfectly from the GUI manually!
This leads me to think I must be missing some setting in the batch file that lets Avidemux accept the instruction to process 2 pass encoding from the batch file.
Could it be as simple as that? -
@Ahari
Do you deinterlace your avi DV or you want to keep interlacing ? -
I think I want to deinterlace as it plays better on the PC players. I'm really not too sure. I want to have the files as an archive of my home movies and want to be able to join them together and edit them at a later date into a short movie or two to share with my family. Also want to play them on my Mede8er.
I hear that you lose detail from the original when you do, but in my tests the Yadif filter seemed to do a great job and I couldn't tell the difference. In fact on the VLC player the de-interlaced files look better than the ones de-interlaced by the player on the fly!
Do you lose perceived frames when you deinterlace? Or should you also increase the frame rate when you de-interlace?
I just don't know yet - been so busy trying to get the darn batches working! I'm tired of this now. Thought it was going to be simple!!
I am at the point of giving other software a try. -
Most freeware GUIs nowadays are really GUIs, meaning frontends for other tools, so they either come with the tools they use or they want you to install them.
-
I think I want to deinterlace as it plays better on the PC players. I'm really not too sure. I want to have the files as an archive of my home movies and want to be able to join them together and edit them at a later date into a short movie or two to share with my family. Also want to play them on my Mede8er.
-
I have been doing some reading and I may have been barking up the wrong tree.
Is Constant Rate Factor (CRF) better than Average Bitrate?
If so what setting should I use for my home videos - I would prefer to err on the side of too much quality than too little. -
Atak_Snajpera, if I may ask, what are your reasons for suggesting that I don't de-interlace?
Reason I ask is that I have read that before, but all the tests I have done suggest I should de-interlace. -
I just had a quick look at StaxRip - no good for my needs - the batch function wants each filename to not contain parts of another file name!
All my home movies are named by the date and time they were taken and there is no way I am renaming them! Pity, it looked good. -
Is Constant Rate Factor (CRF) better than Average Bitrate?
(if filesize is equal 2pass and 1pass crf produce nearly identical quality, difference is measurable but normally not visible)
-> there's no "X is better", abr and crf aim for different things (don't use 1pass abr unless you need to; since average quality will be worse when comparing 1pass abr with 1pass cfr and 2pass abr for the same output size; unless you use really high bitrates)
If so what setting should I use for my home videos - I would prefer to err on the side of too much quality than too little.
I just had a quick look at StaxRip - no good for my needs
Cu Selur -
I am in the company of experts!
My thanks to everyone for your patient help.
By changing to CRF mode all my problems have disappeared!! After some tests, I have settled on CRF 18 - seems to work well for my videos.
Last question (I hope!): By de-interlacing, the frames appear much sharper, but the video playback is more jerky and not as smooth. I heard that if you deinterlace you should increase the fps from 25 to 50 (I'm on PAL).
Is that right and if so, what is the best way to do it?
Atak_Snajpera says I should not de-interlace.
What to do?
Similar Threads
-
Lossless Conversion from AVI H.264 to MP4 H.264
By kenchen in forum Video ConversionReplies: 3Last Post: 22nd Oct 2010, 14:04 -
Help With Batch Encoding Multiple DV files to h.264 MP4's.
By mpalm887 in forum Video ConversionReplies: 2Last Post: 27th Jan 2010, 23:02 -
Batch processing .AVI
By R2 in forum Newbie / General discussionsReplies: 2Last Post: 12th Feb 2008, 20:34 -
What is the best program to convert from H.264 mp4 to H.264 avi?
By Stealth3si in forum Video ConversionReplies: 6Last Post: 15th Sep 2007, 10:11 -
Converting .avi (Xvid) to .mp4 or .mkv (H.264 or x.264) w/ subs
By Tensai in forum Video ConversionReplies: 4Last Post: 18th Jul 2007, 09:25