Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Revolver] 59.94 to 29.97 fps not properly converted #6
When I try to convert a Gopro video, the resulting proxy and hires videos are not properly converted.
The source fps is 59.94, and i want to convert it to 29.97. The resulting proxy and hires versions however have different lengths in audio and video of 1 frame. e.g. the video is 3298 frames and audio is 3297 frames. After importing, the video is not properly detected because of the difference in frames.
I dug a little deeper into that problem. Apparently, the final fps for the conversion is calculated by
which in my case of a rendering setting of 29.97 results to 29.970028570928392
However, the official NTSC framerate is calculated via 30000/1001, which results to 29.97002997002997. That seems weird.
So then I tried converting the video myself, with a framerate of 30000/1001 with
ffmpeg -i "GOPR7304[59.94fps].MP4" -y -probesize 5000000 -s 640x368 -c:v prores -profile:v 0 -qscale:v 13 -vendor ap10 -pix_fmt yuv422p10le -acodec pcm_s16be -r 30000/1001 -ar 48000 "GOPR7304[29.97fps].mov"
However, also here the frames of audio and video are different.
Next try was to leave the audio untouched and just transcode the video:
ffmpeg -i "GOPR7304[59.94fps].MP4" -y -probesize 5000000 -s 640x368 -c:v prores -profile:v 0 -qscale:v 13 -vendor ap10 -pix_fmt yuv422p10le -acodec copy -r 30000/1001 "GOPR7304[29.97fps].mov"
Still no luck.
So, I tried to use a final fps of 30, still leaving audio untouched:
ffmpeg -i "GOPR7304[59.94fps].MP4" -y -probesize 5000000 -s 640x368 -c:v prores -profile:v 0 -qscale:v 13 -vendor ap10 -pix_fmt yuv422p10le -acodec copy -r 30 "GOPR7304[29.97fps].mov"
And this actually worked! Which means, if I convert my source video of 59.94fps to 30fps, then blender will actually show audio and video of same lengths, when blender is set to 29.97. They are different though, when blender is set to 30fps. This also works, when audio is transcoded too.
So I think, inside the revolver code, the following should be changed:
Line #341 OLD: fps = render.fps / render.fps_base
Line #372 OLD: fps = render.fps / render.fps_base
I think the reason for this is, that even a 29.97 or 59.94 fps is actually a 30 or 60 fps video, bit with a different timecode. I am not quite sure, how it would be reliably possible to mix videos of 29.97 and 30 fps, since ffmpeg does not seem to transcode these correctly.
computaholic, your question buggered me for several months and I finally had the time to look into it - sorry, things are rushy here, always.
Before Blender 2.77, fps calculation was retrieved simply with "bpy.context.scene.render.fps". When 2.77 was released, this wasn't working both for Velvet Revolver and Velvet Goldmine, so I assumed Blender had changed he way to refer to it.
I changed my code to these lines to make the transcoding happen:
You opened this issue pointing exactly to this change and I kept asking myself - maybe what I did was a mistake. So I now had finally the time to retest it using the old way and things are working as expected.
So, bottom line: you were right. Actually this might have been a Velvets mistake instead of FFMpeg's. If you're still into it, please retry and see if things are ok now. Sorry for the major delay in answering - I'm working on many projects at the same time and never really had the peace of mind to check it (but kept it in my radar).