Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: I12learn on April 19, 2014, 04:40:21 PM

Title: avidemuxcli3, how to resize videos?
Post by: I12learn on April 19, 2014, 04:40:21 PM
Hello,
I'd like to apply resizing to a bunch of video, via batch it's preferred.
I saw in the package some ready functions, like */share/ADM_scripts/video/filter.js.
Here's the question, I'm not aware of ECMA scripts, how to make a script which will be loaded at the CLI and proceed to do me the right processing.
Basically I'd like to have to try out some options
I think some beginning should be like//AD

include("video/filter.js");

var app = new Avidemux();

But the rest is uncertain. I'd like rather to think as tinypy script, but where'll be the difference?
Meanwhile I'll try something
Title: Re: avidemuxcli3, how to resize videos?
Post by: mean on April 22, 2014, 01:26:42 PM
Look at the DVD etc... auto script
They are tinypy and do resizing (they even compute the size they want to resize to)

Title: Re: avidemuxcli3, how to resize videos?
Post by: I12learn on April 28, 2014, 01:42:59 AM
Sorry, I bit late. I'm busy to get around this matter, with different approach.  :-\  :-[
Here's the snippet (taken from DVD.js):    var result = videoAutoWizard(QT_TR_NOOP("DVD Auto Wizard"));

    if (result)
    {
        var props = getVideoProperties(app.video);
        var fps1000 = props[2];
        var targetX = 720;

        if (getColourEncodingSystem(fps1000) == "NTSC")
            targetY = 480;
        else
            targetY = 576;

        var sourceRatio = result[1][0] + ":" + result[1][1];
        var destinationRatio = result[2][0] + ":" + result[2][1];

        resizeAndFillVideo(targetX, targetY, sourceRatio, destinationRatio);


Well, I'd rather like to avoid the use of videoAutoWizard(QT_TR_NOOP("DVD Auto Wizard")) and assume a fixed aspect ratio to 1:1.

if I just want to keep one of the 2 dimension into the given limits, my question would be about what are the sourceRatio and destinationRatio, values?
Basically, I'd like to skip all the interactions and go straight to define (for example)
var targetX = 1280
var targetY = 768
var sourceRatio = '1:1'
var destinationRatio) = '1:1'
resizeAndFillVideo(targetX, targetY, sourceRatio, destinationRatio);


Avidemux v (r9024), I didn't find tinypy scripts. Maybe I should try a more recent setup.
Title: Re: avidemuxcli3, how to resize videos?
Post by: Jan Gruuthuse on April 28, 2014, 05:45:05 AM
not 100% sure, have not looked at it myself: look at attached 70show.py (http://avidemux.org/smuf/index.php/topic,16140.msg70270.html#msg70270)
Title: Re: avidemuxcli3, how to resize videos?
Post by: I12learn on April 29, 2014, 03:39:41 PM
I would like to have a preset to load and use a batch conversion, without gui, as per option to run on my home server.
That thread and its script were taken for good, but some video needs to be downsized.
Title: Re: avidemuxcli3, how to resize videos?
Post by: Jan Gruuthuse on April 30, 2014, 06:22:24 AM
the load settings is the easy part:
- make the required settings for certain type of video (container, codec(s), resolution, ...) in avidemux GUI
- save this from menu: File: Tinypy Project: Save as Project. Give these a recognizable name so you know what the job does.
- edit the saved job with gedit or notepad++ (don't use word processing program)
-- remove the line (in bold) pointing to the video file used in it:
Quote#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
adm.loadVideo("/media/Recording/720p4audioTracks3sat.ts")
-- save job
- the saved job can now be called from command line with switch --run SavedJob.py
some more info: http://www.avidemux.org/admWiki/doku.php?id=tutorial:batch_processing#tips

the hard part: I don't know how to get/recognize the criteria to detect resolutions to use in script to call what job you want.

update: some wild guessing:
in batch/scripte you would need to call avidemux or another program, perhaps mediainfo if you can't do it with avidemux.
get the info you require (perhaps filtering output) and based upon that info select the wanted job to call on the command line.
as I'm not that great in scripts, can't offer you much help on this process. sorry

Title: Re: avidemuxcli3, how to resize videos?
Post by: I12learn on May 01, 2014, 10:48:38 AM
Dear Jan,
the auto resizing is a different story.
I have a good setting since last time, but the input files are of different size. The old setting it just take the input file and convert it in a different muxer.
There's a good script in */lib/ADM_plugins6/autoScripts/dvd.js, but it is with a dialog option. I can't assume options for batch process. I would assume a fixed maximum dimensions and the AD would recalculate the new size.
The only unknown variables are sourceRatio, destinationRatio
Title: Re: avidemuxcli3, how to resize videos?
Post by: Jan Gruuthuse on May 01, 2014, 01:08:36 PM
I'm doing this manually: creating sub folder(s) for different resolutions or sources and have the script in there running with the correct settings from a job.py. Not as nice solution. But a solution is beyond my scripting capability.
I figure you could get there with some kind of conditional testing before loading video in avidemux. And execute a job on that condition. Perhaps someone finds a solution for you.
Title: Re: avidemuxcli3, how to resize videos?
Post by: I12learn on May 02, 2014, 11:43:46 AM
Quote from: Jan Gruuthuse on April 30, 2014, 06:22:24 AM
update: some wild guessing:
in batch/script you would need to call avidemux

Avidemux has the power and the capabilities, no external call are needed. It can rearrange the new frame size and additional padding if any.
My difficulties are about understand what means those 2 parameters and then ... les joeux son fait :)
Title: Re: avidemuxcli3, how to resize videos?
Post by: Jan Gruuthuse on May 02, 2014, 01:20:56 PM
Can you do something with this: getWidth and getHeight found @ http://www.avidemux.org/admWiki/doku.php?id=using:scripting#avidemux_video_functions