DVCPRO adds 1 frame to the file metadata

Here you can submit bugreports
User avatar
FranceBB
Posts: 265
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: DVCPRO adds 1 frame to the file metadata

Post by FranceBB »

I can reproduce

Code: Select all

ColorBars(848, 480, pixel_type="YV12")

trim(0, 100)
This will give you a 101 frames clip.
Image

Code: Select all

ColorBars(848, 480, pixel_type="YV12")

trim(0, 100)

FadeIn(1)
This will give you a 103 frames clip (2 frames are added).
Image

Code: Select all

ColorBars(848, 480, pixel_type="YV12")

trim(0, 100)

FadeOut(1)
This will give you a 102 frames clip (1 frame is added).
Image

So it really looks like FadeIn() adds 2 frames, but FadeOut() adds 1, which is... weird.
I don't really have an answer, though, on whether that's unexpected or not, so I redirected the question to Ferenc and Stephen.
But yeah, as emcodem said, not bad for a bug report, movalex xD
movalex
Posts: 36
Joined: Thu Feb 06, 2020 2:23 pm

Re: DVCPRO adds 1 frame to the file metadata

Post by movalex »

With the updated workflow by @emcodem, the duration of the result file is correct, but the fade is not, as it does not fade to complete black, which is also a prerequisite. So I dived a bit into AviSynth and realized there's some options I can use for my rare case.

Basically I trimmed the source video, then used the FadeIO2, which adds the fade to color with two frames at both ends simultaneously, and then trimmed one excessive frame at the end. Hence I get the video with correct length, with 6 fading frames and complete black frame at both ends.

http://avisynth.nl/index.php/Fade

Code: Select all

audio = m_clip
video = m_clip

# Trim one frame from both ends
video = Trim(video, 1, video.FrameCount-2)

# Fade video with adding 2 frames at both ends
video = FadeIO2(video, 6)

# Trim one extra frame from both ends
video = Trim(video, 1, video.FrameCount-2)

# Dub audio back to the video
m_clip = AudioDub(video, audio)

return m_clip
I cannot express how grateful I am for all the help and and tips you share here. A huge thanks to all of you for this amazing adventure of frame picking!
Attachments
NAEFIR SD DV avisynth-fade.json
(15.77 KiB) Downloaded 125 times
emcodem
Posts: 1812
Joined: Wed Sep 19, 2018 8:11 am

Re: DVCPRO adds 1 frame to the file metadata

Post by emcodem »

Well done, glad you liked it :geek: ! It appears FadeIO2 is not "misbehaving" like FadeIn and adds exactly the frames that it should add.
Let's hope the behaviour is consistent but as it behaves as documented i guess you are on the safe side

I really don't like that the topic about apad filter adding odd number of milliseconds to the audio stays open... maybe i find the time to reproduce it and pinpoint the issue later. Of course there are chances that its not even an ffmpeg problem but currently it appears like it because avisynth never reported such odd audio durations using "return Info(m_clip)"

And someone (@FranceBB) might want to take care about the wrongly generated avisynth lines the fade filter generates when checking/unchecking the different checkboxes? :D
emcodem, wrapping since 2009 you got the rhyme?
User avatar
FranceBB
Posts: 265
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: DVCPRO adds 1 frame to the file metadata

Post by FranceBB »

emcodem wrote: Mon Sep 23, 2024 8:50 pm And someone (@FranceBB) might want to take care about the wrongly generated avisynth lines the fade filter generates when checking/unchecking the different checkboxes? :D
Sure. As for the 2 frames in FadeIn(), I hope it's gonna be fixed in the AviSynth+ 3.7.4 release due by the end of the year.
Post Reply