• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Documentation on scripting for video?

Engaged ,
Mar 25, 2017 Mar 25, 2017

Copy link to clipboard

Copied

Does anyone know if there is any documentation on scripting for video in Photoshop. In particular, I just want information for the DOM relating to video. From what I can tell, the Adobe documentation doesn't cover anything related to video. It seems like a "black box".

TOPICS
Actions and scripting

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Enthusiast ,
Mar 25, 2017 Mar 25, 2017

Copy link to clipboard

Copied

I don't know about official documentation.

With action manager code you can get these informations:

In smartObjectMore is some info about frames and duration ect.

With script listener you probably could record some commands related to video.

{

    "name": "Štěpán%20Bechynský-SD",

    "color": "none",

    "visible": true,

    "mode": "normal",

    "opacity": 255,

    "layerID": 28,

    "itemIndex": 27,

    "count": 27,

    "preserveTransparency": false,

    "layerFXVisible": false,

    "globalAngle": 90,

    "background": false,

    "layerSection": "layerSectionContent",

    "layerLocking": {

        "protectTransparency": false,

        "protectComposite": false,

        "protectPosition": false,

        "protectArtboardAutonest": false,

        "protectAll": false

    },

    "group": false,

    "targetChannels": [

        {

            "count": 5,

            "typename": "ActionDescriptor"

        },

        {

            "count": 5,

            "typename": "ActionDescriptor"

        },

        {

            "count": 5,

            "typename": "ActionDescriptor"

        }

    ],

    "visibleChannels": [

        {

            "count": 5,

            "typename": "ActionDescriptor"

        },

        {

            "count": 5,

            "typename": "ActionDescriptor"

        },

        {

            "count": 5,

            "typename": "ActionDescriptor"

        }

    ],

    "channelRestrictions": [

        "red",

        "grain",

        "blue"

    ],

    "fillOpacity": 255,

    "hasUserMask": false,

    "hasVectorMask": false,

    "proportionalScaling": false,

    "layerKind": 5,

    "hasFilterMask": false,

    "userMaskDensity": 255,

    "userMaskFeather": 0,

    "vectorMaskDensity": 255,

    "vectorMaskFeather": 0,

    "bounds": {

        "top": 220,

        "left": 214,

        "bottom": 580,

        "right": 854,

        "width": 640,

        "height": 360

    },

    "boundsNoEffects": {

        "top": 220,

        "left": 214,

        "bottom": 580,

        "right": 854,

        "width": 640,

        "height": 360

    },

    "boundsNoMask": {

        "top": 220,

        "left": 214,

        "bottom": 580,

        "right": 854,

        "width": 640,

        "height": 360

    },

    "smartObject": {

        "placed": "rasterizeContent",

        "documentID": "",

        "compsList": {

            "compID": -1,

            "originalCompID": -1

        },

        "linked": false,

        "fileReference": "Štěpán%20Bechynský-SD.psb"

    },

    "useAlignedRendering": false,

    "generatorSettings": {

       

    },

    "keyOriginType": [

       

    ],

    "fillEnabled": false,

    "animationProtection": {

        "animationUnifyPosition": false,

        "animationUnifyEffects": false,

        "animationUnifyVisibility": false,

        "animationPropagate": true

    },

    "artboard": {

        "artboardRect": {

            "top": 0,

            "left": 0,

            "bottom": 0,

            "right": 0

        },

        "guideIDs": [

           

        ],

        "artboardPresetName": "",

        "color": {

            "red": 255,

            "grain": 255,

            "blue": 255

        },

        "artboardBackgroundType": 1

    },

    "artboardEnabled": false,

    "vectorMaskEnabled": false,

    "vectorMaskEmpty": true,

    "textWarningLevel": 0,

    "smartObjectMore": {

        "ID": "f4445b3c-11a8-11e7-ae40-d173f257a8cd",

        "placed": "f4445b3b-11a8-11e7-ae40-d173f257a8cd",

        "pageNumber": 1,

        "totalPages": 1,

        "crop": 1,

        "frameStep": {

            "numerator": 24,

            "denominator": 600

        },

        "duration": {

            "numerator": 1346496,

            "denominator": 600

        },

        "frameCount": 2,

        "antiAliasType": 16,

        "type": 2,

        "transform": [

            214,

            220,

            854,

            220,

            854,

            580,

            214,

            580

        ],

        "nonAffineTransform": [

            214,

            220,

            854,

            220,

            854,

            580,

            214,

            580

        ],

        "warp": {

            "warpStyle": "warpNone",

            "warpValue": 0,

            "warpPerspective": 0,

            "warpPerspectiveOther": 0,

            "warpRotate": "horizontal",

            "bounds": {

                "top": 0,

                "left": 0,

                "bottom": 360,

                "right": 640

            },

            "uOrder": 4,

            "vOrder": 4

        },

        "size": {

            "width": 640,

            "height": 360

        },

        "resolution": 72,

        "comp": -1,

        "compInfo": {

            "compID": -1,

            "originalCompID": -1

        }

    }

}

//////////////

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

How did you get that data from action manager?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

Good question. I'm not good at modifying AM code. I asked Jeff Tranberry about a project I wanted to do with video, and he just replied that it's "Dark magic." Davide Barrenca is in the process of writing a book on extendscript and including how to work with AM code. He gave me a sneak peek, and it looks like it will be a great resource.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

I'll be looking forward to seeing the AM code documentation that Davide comes up with.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2017 Mar 25, 2017

Copy link to clipboard

Copied

I don't think there is any info on using the DOM for video editing, and I doubt that you can. AM code runs faster, so you most likely will be limited to what you can get from scriptlistener - if anything.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

That is kind of what I thought. I wonder if there is even anything created in the DOM for video. I think I already figured out how to do what I am trying to do using script listener. I basically just want to loop through each frame and then run an action on each frame.  I just thought it would be nice if there was stuff that could be done using the DOM.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

There haven't been any major improvements to the DOM for years, well before video was added to PS, and as I mentioned earlier, AM code runs faster.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

I do use script listener/AM for a lot of things. I was just looking for an easy way to get the current minute, second, frame count for whatever frame it is on.  I figured if it was in the DOM then I could just easily retrieve the data without have to create cryptic action descriptors (which I am not very good at). I basically just want to be able to specify a start and stop point to process a section of the video. Anyway, I'll post if I can figure out how to read the current minutes / seconds / frame using AM code. I'm pretty sure it can be done.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

You can use: GitHub - JavierAroche/descriptor-info: JSX module to recursively get all the properties in an Action...

I used it for properties JSON above. (only for reading) This will do all black magic instead you. You only need to get action descriptor.

Timeline position is not stored in layer. It could be in document descriptor.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

Thanks, I'll look into the Github doc you posted.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 27, 2017 Mar 27, 2017

Copy link to clipboard

Copied

LATEST

I found an old post by Mike Hale showing how to get the total frame count which works. I tried applying this same method to get the frame rate and the current frame hours, seconds, minutes and frame. The frame rate function works but not the hours,minutes,second and frame. I think those link to "timecode" instead of "timeline". The script listener function to goto a specific timecode works. I was trying to piece together AM code to get the current the hours, minutes, seconds and frame based on the info in the script listener code but. I tried MANY combinations of things but couldn't get anything to work. Honestly, I have a hard time wrapping my brain around AM code.

Any ideas on how to get the hours,minutes,seconds and frame functions to work?

function getTotalFrameCount(){

    var ref = new ActionReference();

     ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "frameCount" ) );

     ref.putClass( stringIDToTypeID( "timeline" ) );

     var desc = new ActionDescriptor();

     desc.putReference( charIDToTypeID( "null" ), ref );

     var resultDesc = executeAction( charIDToTypeID( "getd" ), desc, DialogModes.NO );

    

     return resultDesc.getInteger( stringIDToTypeID( "frameCount" ) );

}

function getFrameRate(){

    var ref = new ActionReference();

     ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "frameRate" ) );

     ref.putClass( stringIDToTypeID( "timeline" ) );

     var desc = new ActionDescriptor();

     desc.putReference( charIDToTypeID( "null" ), ref );

     var resultDesc = executeAction( charIDToTypeID( "getd" ), desc, DialogModes.NO );

    

     return resultDesc.getDouble( stringIDToTypeID( "frameRate" ) );

}

function getFrameHours(){

    var ref = new ActionReference();

     ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "hours" ) );

     ref.putClass( stringIDToTypeID( "timeline" ) );

     var desc = new ActionDescriptor();

     desc.putReference( charIDToTypeID( "null" ), ref );

     var resultDesc = executeAction( charIDToTypeID( "getd" ), desc, DialogModes.NO );

    

     return resultDesc.getInteger( stringIDToTypeID( "hours" ) );

}

function getFrameMinutes(){

    var ref = new ActionReference();

     ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "minutes" ) );

     ref.putClass( stringIDToTypeID( "timeline" ) );

     var desc = new ActionDescriptor();

     desc.putReference( charIDToTypeID( "null" ), ref );

     var resultDesc = executeAction( charIDToTypeID( "getd" ), desc, DialogModes.NO );

    

     return resultDesc.getInteger( stringIDToTypeID( "minutes" ) );

}

function getFrameSeconds(){

    var ref = new ActionReference();

     ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "seconds" ) );

     ref.putClass( stringIDToTypeID( "timeline" ) );

     var desc = new ActionDescriptor();

     desc.putReference( charIDToTypeID( "null" ), ref );

     var resultDesc = executeAction( charIDToTypeID( "getd" ), desc, DialogModes.NO );

    

     return resultDesc.getInteger( stringIDToTypeID( "seconds" ) );

}

function getFrame(){

    var ref = new ActionReference();

     ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "frame" ) );

     ref.putClass( stringIDToTypeID( "timeline" ) );

     var desc = new ActionDescriptor();

     desc.putReference( charIDToTypeID( "null" ), ref );

     var resultDesc = executeAction( charIDToTypeID( "getd" ), desc, DialogModes.NO );

    

     return resultDesc.getInteger( stringIDToTypeID( "frame" ) );

}

function goToFrame(h,m,s,f,r){

var idsetd = charIDToTypeID( "setd" );

    var desc14 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref2 = new ActionReference();

        var idPrpr = charIDToTypeID( "Prpr" );

        var idtime = stringIDToTypeID( "time" );

        ref2.putProperty( idPrpr, idtime );

        var idtimeline = stringIDToTypeID( "timeline" );

        ref2.putClass( idtimeline );

    desc14.putReference( idnull, ref2 );

    var idT = charIDToTypeID( "T   " );

        var desc15 = new ActionDescriptor();

        var idhours = stringIDToTypeID( "hours" );

        desc15.putInteger( idhours, h );

        var idminutes = stringIDToTypeID( "minutes" );

        desc15.putInteger( idminutes, m );

        var idseconds = stringIDToTypeID( "seconds" );

        desc15.putInteger( idseconds, s );

        var idframe = stringIDToTypeID( "frame" );

        desc15.putInteger( idframe, f );

        var idframeRate = stringIDToTypeID( "frameRate" );

        desc15.putDouble( idframeRate, r );

    var idtimecode = stringIDToTypeID( "timecode" );

    desc14.putObject( idT, idtimecode, desc15 );

executeAction( idsetd, desc14, DialogModes.NO ); 

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines