Log in

View Full Version : Question regarding ffms2.dll and source framerate


Chainmax
16th June 2010, 22:07
I a trying to process a clip shot with my cellphone, and for some reason the output in a simple FFVideoSource("X:\wherever\myclip.mp4") ends up with a framerate of 61.225fps, whereas ffdshow reports the video as hovering around 28.5fps on playback. Any ideas on why this is happening, and how to avoid it (if possible)?

[edit] Hmm...DSS opened it as a 25fps clip...I'm really stumped here.

Chainmax
19th June 2010, 14:55
I stepped through the ffms2-sourced clip, and it's hard to tell if some kind of motion interpolation took place: small movements show distinct frames, and sudden pans are all blurry, but these were taken with a cellphone after all. Video is supposed to be taken at exactly 30fps according to spec sheet, maybe I should just add ChangeFPS(30) right after loading the source and be done with it?

Blue_MiSfit
19th June 2010, 20:43
You should probably use AssumeFPS instead. ChangeFPS will add or delete frames. AssumeFPS just changes the playback speed.

I've seen plenty of cases where decoders change the displayed frame rate.

Derek

Chainmax
21st June 2010, 03:08
I found out that FFVideoSource actually picked up the source at roughly twice the speed, which makes your suggestion make even more sense. However, doing an AssumeFPS down to a non-submultiple (impossible for a decimal framerate like 61.225 anyway) would likely cause synch errors, so I am thinking something like this:

A = FFAudioSource("X:\audiosauce.wav")
V = FFVideoSource("X:\videosauce.mp4")
AudioDub(V, A)

TimeStretch(tempo=(100.0*30)/61.225)

AssumeFPS(30,true)

would be a sensible way to go. Would you agree?



[edit] Nope, doesn't work. The audio comes up as extremely slowed down and maybe even cut in half its length. What am I missing here?

PhrostByte
21st June 2010, 08:26
Can you AudioDub after the AssumeFPS?

Gavino
21st June 2010, 08:43
A = FFAudioSource("X:\audiosauce.wav")
V = FFVideoSource("X:\videosauce.mp4")
AudioDub(V, A)

TimeStretch(tempo=(100.0*30)/61.225)

AssumeFPS(30,true)
... The audio comes up as extremely slowed down and maybe even cut in half its length. What am I missing here?
By using true in AssumeFPS, you are changing the audio speed twice - use false.

But if the audio has the correct duration to start with, you don't want the TimeStretch either. Have you checked this?

Chainmax
23rd June 2010, 18:45
Blue_MiSfit: The file is actually VFR, this is yet one of those damn weak phones that cannot sustain CFR or let you choose a lower but constant rate. Dealing with VFR would be too much of a hassle for this particular recording, so AssumeFPS it is then.

PhrostByte: that would be the same as processing the file externally and muxing it to the final video, so even including the audio in the script would be useless.

Gavino: very good point. Audacity states the audio as lasting for ~32.53s, and 925 frames at 30fps make for a video duration of ~30.83s. So, the audio does need stretching. I think I'll do that separately in Audacity, filter the audio and mux it into the final video.

aegisofrime
24th June 2010, 03:41
From my experience, FFVideoSource does not always detect the right framerate. What I would do then is to use:

FFVideoSource("YourVideo.avi",fpsnum=30,fpsden=1)

This specifies a framerate of 30fps. For 29.97, use fpsnum=30000,fpsden=1001.