Page 1 of 1
Clipping Video Giving Odd Duration
Posted: Fri Jan 11, 2019 1:59 pm
by graham728
Hi,
I have the below script to remove 10 seconds from the front of a video and 5 seconds from the end.
m_clip = Trim(m_clip, 250, end=m_clip.framecount-125) #25 fps
Return m_clip
Now say I've submitted a 30-second commercial with the ten-second front and tail needing to be trimmed, the outputted file is 30 seconds and 1 frame...
I changed the script to 126 frames off the end to compensate for this extra frame.
m_clip = Trim(m_clip, 250, end=m_clip.framecount-126) #25 fps
Return m_clip
The outputted file is now 30 seconds and premiere pro believes it is 30 seconds and 0 frames, great... Although if I use mediainfo application it gives a duration of 30 seconds and 22 ms.
The inputted file is an AVC Intra 100 MXF OP1a file.
Any ideas?
Re: Clipping Video Giving Odd Duration
Posted: Fri Jan 11, 2019 10:13 pm
by emcodem
Hey Graham,
i believe i have an answer for you but just to be sure: as far as i understand, everything is OK with your processing in general but you are asking for the reason what is the reason for the different decoders (premiere and mediainfo) showing different durations of your media file, correct?
So this is just about some learning or hypotetical question instead of a problem, right?
What is your output audio and video codec shown by mediainfo?
cheers,
emcodem
Re: Clipping Video Giving Odd Duration
Posted: Sat Jan 12, 2019 1:57 pm
by graham728
Hi,
The outputted file is AVC and AAC audio MP4.
The outputted MP4 is sent to an online streaming service, I sent them a test file and they didn't have any issues with it. I'm just never comfortable living with little inconsistencies like this.
If I clip up the AVC Intra MXF within Media Encoder to the same specs media info gives me the correct duration of 30 seconds.
Thanks
Re: Clipping Video Giving Odd Duration
Posted: Sun Jan 13, 2019 7:55 am
by emcodem
Hey Graham,
typically mxf contains uncompressed Audio also Audio and Video Frames are packetized so they match each other 100%, means after each Video Frame with Duraion X (e.g. 40ms duration), you find exactly 40ms Audio (per Audio channel of course). So in a High-res MXF it is not only possible but natural that Audio and Video Tracks have the exact same duration.
In high compressed delivery formats like the AVC and AAC you mention, it is the opposite: typically, users do not configure their encoders to create Audio frames that match exactly the duration of the video frames. Instead, you rely on some default audio frame duration which results in the Audio and Video track having naturally different durations.
Also AAC has another problem for Decoders to solve, priming:
https://developer.apple.com/library/arc ... ppenG.html
For the AAC decoder priming, typically 1024 samples of quiet audio are pre-pended to the Audio stream, which translates to roughly 21-22 milliseconds @48000hz.
There is no standard that defines what a decoder should do when the Audio and Video track durations are different, so one Decoder (or Analyzer) might present you the video duration, the other one the audio duration and the next one might present both to you.
Is that what you were after?
cheers,
emcodem