After done editing, I exported only to see that audio and video do not sync. I know what the problem is - the project's video strips have a variable frame rate. But is there a way to make Blender sync them despite that? I don't want to encode every clip that I have with a CFR.
-
$\begingroup$ check having the timeline > playback > av sync setting enabled (default is off), as a start. $\endgroup$– m.arditoCommented Aug 1, 2017 at 11:45
-
$\begingroup$ Thanks, but it is on already. The sync disappears only when exported. $\endgroup$– Don LemonsCommented Aug 1, 2017 at 12:06
-
1$\begingroup$ Blender does not do variable frame rate decode. Sorry, you'll have to transcode to use the VSE in sync $\endgroup$– 3pointeditCommented Aug 1, 2017 at 12:27
-
$\begingroup$ Oh well, thanks! I just encoded all the clips anyway. But still, for some odd reason Handbrake hasn't worked properly on Windows for me, only on Linux. The files are smaller and at a constant frame rate, yes, but Blender can barely handle them, so editing and rendering is very slow. $\endgroup$– Don LemonsCommented Aug 1, 2017 at 13:18
-
$\begingroup$ My guess is that the screen dimensions of your recording is quite large. Blender decompresses your video into full color frames, have a look at your memory as you scrub through the timeline, I expect that you will be using most of the available ram. Consider making proxies. $\endgroup$– 3pointeditCommented Aug 1, 2017 at 13:32
2 Answers
Blender does not allow you to decode variable frame rates. Sorry, this is because Blender is only aware of one frame at a time and expects to play 1 frame per frame. In other words it is temporaly blind (can't look ahead) and doesn't understand that you may want to hold the current frame for a period of time. You'll have to transcode to a compatible Codec to use the VSE in sync with audio.
-
$\begingroup$ this could be a good feature request, perhaps... even if a corner case probably. $\endgroup$– m.arditoCommented Aug 1, 2017 at 18:52
-
$\begingroup$ Support for variable frame rates opens up a can of worms regarding time stamps. It is not entirely unreasonable to find files with discontinuous time stamps (advertisement splices, concatenated transport streams) and then there's the simple case of a file that was encoded at a frame rate that does not match the project fps. $\endgroup$ Commented Aug 1, 2017 at 20:21
When I have had to deal with variable-frame-rate video I use ffmpeg to render it to PNGs at a fixed frame rate.
ffmpeg -i screencap.mp4 -vf fps=30 $(OD1)/%04d.png
ffmpeg will "resample" the video temporally, probably duplicating some frames. It might even drop frames if your source video has some really short inter-frame intervals. Just pick fps=
to match the rate of your VSE project to make your life easy.
Once you have the PNG sequence you can use that as the source for your VSE strip.
edit: Since you have mentioned you have a large library of clips, I would create a makefile
/var/tmp/cfr/%/0001.png: %.mp4
ffmpeg -i $< -vf fps=30 /var/tmp/cfr/$*/%04d.png
Alternately, you could have a shell script that iterates through the video files to perform the conversion
for f in "$@"; do
d=/var/tmp/cfr/$(basename $f .mp4)
ffmpeg -i $f -vf fps=30 $d/%04d.png
-
$\begingroup$ I've hundreds of video clips, how do you expect me to manage such a mess! :D $\endgroup$ Commented Aug 1, 2017 at 15:31
-
$\begingroup$ ffmpeg can run through all the clips in a folder and create new files for you. $\endgroup$ Commented Aug 1, 2017 at 23:51