News:

--

Main Menu

script for quicktime to mpy with rotate

Started by johnbail, August 27, 2012, 12:46:45 AM

Previous topic - Next topic

johnbail

Hello,

I am having issues trying to find a script to rotate a mov format 90 degrees and save as mp4 any help would be great.

johnbail

#1
I have this script working with one file but not with others.  I know I am missing something simple but I can not find any information that points mw to the problem.

the command line throws a xml parse error "start tag expected."
I am thinking it is the different file sizes or frame rate but as I said I am cluless.

//AD  <- Needed to identify//
//--automatically built--
//--Project: C:\video\newScript

var app = new Avidemux();

//** Video **
// 01 videos source
app.load("C:/video/land.mov");
//01 segments


//** Postproc **
//app.video.setPostProc(3,3,0);
//app.video.setFps1000(app.video.getFps1000());
//app.video.fps1000 = 30013;

//** Filters **
app.video.addFilter("rotate","width=480","height=640","angle=90");

//** Video Codec conf **
app.video.codecPlugin("32BCB447-21C9-4210-AE9A-4FCE6C8588AE", "x264", "CQ=0", "(null)");

//** Audio **
app.audio.reset();
app.audio.codec("copy",2277760,0,"");
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

Jan Gruuthuse

if you can try with 2.6, project looks less complicated in 2.6 (Spidermonkey):
//AD  <- Needed to identify //
//--automatically built--


adm.loadVideo("/home/jan/Videos/test.avi");
adm.clearSegments();
adm.addSegment(0, 0, 1670000);
adm.markerA = 0;
adm.markerB = 1670000;
adm.videoCodec("x264", "general.params=AQ=20", "general.threads=99", "general.fast_first_pass=True", "level=31", "vui.sar_height=1", "vui.sar_width=1", "MaxRefFrames=2", "MinIdr=100", "MaxIdr=500", "MaxBFrame=2", "i_bframe_adaptive=0", "i_bframe_bias=0", "i_bframe_pyramid=0", "b_deblocking_filter=False", "i_deblocking_filter_alphac0=0", "i_deblocking_filter_beta=0", "cabac=True", "interlaced=False", "analyze.b_8x8=True", "analyze.b_i4x4=False", "analyze.b_i8x8=False"
, "analyze.b_p8x8=False", "analyze.b_p16x16=False", "analyze.b_b16x16=False", "analyze.weighted_pred=0", "analyze.weighted_bipred=False", "analyze.direct_mv_pred=0", "analyze.chroma_offset=0", "analyze.me_method=0", "analyze.subpel_refine=7", "analyze.chroma_me=False", "analyze.mixed_references=False", "analyze.trellis=1", "analyze.fast_pskip=True", "analyze.dct_decimate=False", "analyze.noise_reduction=0", "analyze.psy=True", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_min=0", "ratecontrol.qp_max=0"
, "ratecontrol.qp_step=0", "ratecontrol.bitrate=0", "ratecontrol.vbv_max_bitrate=0", "ratecontrol.vbv_buffer_size=0", "ratecontrol.vbv_buffer_init=0", "ratecontrol.ip_factor=0,000000", "ratecontrol.pb_factor=0,000000", "ratecontrol.aq_mode=0", "ratecontrol.aq_strength=0,000000", "ratecontrol.mb_tree=False", "ratecontrol.lookahead=0");
adm.addVideoFilter("rotate", "angle=90");
adm.audioCodec(0, "copy");
adm.audioCodec(1, "copy");
adm.audioCodec(2, "copy");
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True");


rotate has been simplified, no "width=480" and "height=640": adm.addVideoFilter("rotate", "angle=90");

johnbail

thank you. I am really carious about the add Segment should those be removed as I do onto know the length of the video being converted? is there a function that tells me the length or can I leave it blank.

mean


johnbail

#5
I try to use the script on other files when I run it the GUI crashes I can find logs no where. When I run it in the command line I get the following error "options.xml:1: parser error : start tag expected, '<' not found"

I am at a loss at this point I just want to convert any file uploaded to our server to mpy from mov. and solve the portrait problem This is proving to be extremely difficult I have to be missing something. 

this is the windows version is that the problem?

Jan Gruuthuse

#6
You call both scripts from a dos box? Somewhere is a setting in properties, I believe. Set it not to close window automatically when program stops.
type in your browser (internet or filemanager addressbar):
Log should be %appdata%\avidemux\admlog.txt
Don't use complicated, long/deep path names. Scripts could have difficulties with spaces or foreign characters.
D:\My Douments\Video's to process\ or \Comme ça\ or \Fluß\ , ....
Stay close to harddisc root and use folders one or two levels down max.
D:\ToProcess\ or D:\ToProcess\mp4\

Include the paths in filenames for scripting. Linux example:
Quote/usr/bin/avidemux3_cli --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$FIL"  --run /home/jan/mp4TOmkv.js --save ${FIL%.*}.mkv --quit
use windows syntax where needed
XML parsing empty tag? Processing video from external path/device? Comes up on Unix, not found this yet in relation to windows?
When editing scripts/batch files, use editor that keeps text format as it should be. Notepad++ or similar program would do.

johnbail

Thanks you for the information. I have traced it to this line app.video.codecPlugin("32BCB447-21C9-4210-AE9A-4FCE6C8588AE", "x264", "CQ=0", "(null)"); it dose not like "(null") but I can not find a reference to what that parameter should be.

johnbail

When I set the XML I get the following error.
*********** BACKTRACE **************
DumpBackTrace(void*) <+0x95>  [c:\Program Files\Avidemux 2.5\libADM_core.dll]
HandleException(_EXCEPTION_RECORD*, _CONTEXT*) <+0x90>  [c:\Program Files\Avidemux 2.5\libADM_core.dll]
ADM_backTrack <+0xD>  [c:\Program Files\Avidemux 2.5\libADM_core.dll]
ADMVideoRotate::getFrameNumberNoAlloc(unsigned int, unsigned int*, ADMImage*, unsigned int*) <+0xD3>  [c:\Program Files\Avidemux 2.5\plugins\videoFilter\libADM_vf_rotate.dll]
externalEncoder::encode(unsigned int, ADMBitstream*) <+0x3D>  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
oplug_mp4(char const*, ADM_OUT_FORMAT) <+0xA6E>  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
A_Save(char const*) <+0x52C>  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
automation() <+0x251>  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
UI_RunApp() <+0x12>  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
main <+0x42C>  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
unknown function  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
unknown function  [c:\Program Files\Avidemux 2.5\avidemux2_cli.exe]
BaseThreadInitThunk <+0xD>  [C:\Windows\system32\kernel32.dll]
RtlUserThreadStart <+0x21>  [C:\Windows\SYSTEM32\ntdll.dll]
*********** BACKTRACE **************

Jan Gruuthuse

Quote from: johnbail on September 05, 2012, 12:50:03 PM
Thanks you for the information. I have traced it to this line app.video.codecPlugin("32BCB447-21C9-4210-AE9A-4FCE6C8588AE", "x264", "CQ=0", "(null)"); it dose not like "(null") but I can not find a reference to what that parameter should be.

set the video codec in the GUI save in project and call that project from command line with --run projectname.
my guess you're using script for earlier version of avidemux?
check this post: 2.6 r8171 CLI --output-format MP4 should be the same principle, just other codec and settings?

johnbail

it seem like any time I change video it fails. is there  a way to get the segment info for script? when I leave when I remove the lines it dose not work.
my current script is attached I pragmatically change the load line then try to process the upload MOV file.

I am under the impreseion that if I remove
app.clearSegments();
app.addSegment(0,0,956);
app.markerA=0;
app.markerB=955;

I should be able to process video of different lengths but this is not working I keep getting errors.

Jan Gruuthuse

If you keep these settings you only save the part that is marked?
All videos use same audio encoding/audio/tracks/video codec resolution?
Replace avidemux3_cli.exe by the avidemux.exe (the one starting Graphics User interface)
will not look nice, but you should be abble to follow what is going on.
In short don't use the command line avidemux in your script.

johnbail

I have tried that it just says "load crash info" when you select OK it exist. I have never found a log I have looked in the location stated in a earlier post. I will keep trying.

johnbail

for your questions -
If you keep these settings you only save the part that is marked? Nothing is saved..
All videos use same audio encoding/audio/tracks/video codec resolution? I do ont know done with same iphone.
Replace avidemux3_cli.exe by the avidemux.exe (the one starting Graphics User interface)
will not look nice, but you should be abble to follow what is going on. the UI just crashes..
In short don't use the command line avidemux in your script.

johnbail

#14
Thank you everyone.... I believe I have this solved here is the final script.
cmd line "c:\Program Files\Avidemux 2.5\avidemux2_cli.exe" --force-alt-h264 --load <yourfilehere> --run c:\video\script.txt --
save newTest.mp4

script --
//AD  <- Needed to identify//

var app = new Avidemux();
var len;
//** Video **
// 01 videos source

//01 segments
displayInfo('Hello here I am ');
len = app.markerB+1;
app.clearSegments();
app.addSegment(0,0,len);
app.markerA=0;
app.markerB=len-1;
displayInfo('Hello here I am ' + len);

//** Postproc **
app.video.setPostProc(3,3,0);
//app.video.fps1000 = app.video.getFps1000;

app.video.fps1000 = 30001;
         
//** Filters **
displayInfo('width=' + app.video.width);
displayInfo('height=' + app.video.height);
app.video.addFilter("rotate","width="+app.video.height,"height="+app.video.width,"angle=90");

//** Video Codec conf **
app.video.codecPlugin("32BCB447-21C9-4210-AE9A-4FCE6C8588AE", "x264", "AQ=26", "<?xml version='1.0'?><x264Config><presetConfiguration><name>test</name><type>user</type></presetConfiguration><x264Options><fastFirstPass>true</fastFirstPass><threads>0</threads><deterministic>true</deterministic><sliceThreading>false</sliceThreading><threadedLookahead>-1</threadedLookahead><idcLevel>-1</idcLevel><vui><sarAsInput>false</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>1</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>spatial</directPredictionMode><chromaLumaQuantiserDifference>0</chromaLumaQuantiserDifference><motionEstimationMethod>hexagonal</motionEstimationMethod><motionVectorSearchRange>16</motionVectorSearchRange><motionVectorLength>-1</motionVectorLength><motionVectorThreadBuffer>-1</motionVectorThreadBuffer><subpixelRefinement>7</subpixelRefinement><chromaMotionEstimation>true</chromaMotionEstimation><mixedReferences>true</mixedReferences><trellis>finalMacroblock</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>0</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 **
if (app.audio.targetTrackInfo.length > 0)
{
   if (app.audio.targetTrackInfo[0].codec == "AAC" && app.audio.targetTrackInfo[0].channelCount == 2) {
      app.audio.codec("copy",0,0,"");

   } else {
      app.audio.codec("Faac", 128, 4, "80 00 00 00 ");

      if (app.audio.targetTrackInfo[0].channelCount == 2)
         app.audio.mixer = "NONE";
      else
         app.audio.mixer = "STEREO";
   }
   
   if (app.audio.targetTrackInfo[0].frequency != 48000) {
      app.audio.resample = 48000;
   }
}
app.setContainer("MP4");
setSuccess(1);
//app.Exit();

//End of script