PDA

View Full Version : Variable frame video into constant frame x265


forestcull
29th November 2016, 04:18
I've found that converting variable frame rate files into x265 constant frame always results in significant audio desync. I get this issue using both AviSynth and VapourSynth.

I've considered converting the variable frame file first into x264 constant at crf 0 but I don't consider that an effective solution moving forward for batch conversion. The temp file storage would be huge.

Has anyone figured out a way to convert variable into into constant frame x265 and avoid the audio desync?

sneaker_ger
29th November 2016, 08:54
To convert VFR to CFR:
a.) use VFR aware converter like VidCoder, HandBrake or ffmpeg
b.) in AviSynth or VapourSynth make a VFR->CFR conversion. For example in AviSynth:
a=ffaudiosource("source.mkv")
v=ffvideosource("source.mkv", fpsnum=24000, fpsden=1001) # example for 24/1.001 fps ~= 23.976 fps target
AudioDub(v, a)

Motenai Yoda
29th November 2016, 17:16
extract timecodecs from source file
encode as crf (not convert from vfr to crf)
apply timecodecs to new file when muxing into mkv

forestcull
29th November 2016, 21:28
To convert VFR to CFR:
a.) use VFR aware converter like VidCoder, HandBrake or ffmpeg
b.) in AviSynth or VapourSynth make a VFR->CFR conversion. For example in AviSynth:
a=ffaudiosource("source.mkv")
v=ffvideosource("source.mkv", fpsnum=24000, fpsden=1001) # example for 24/1.001 fps ~= 23.976 fps target
AudioDub(v, a)

Thanks, I'll give this a shot.

extract timecodecs from source file
encode as crf (not convert from vfr to crf)
apply timecodecs to new file when muxing into mkv

I thought about trying this but it doesn't sound like a long term solution for batch conversions.

forestcull
3rd December 2016, 03:34
a=ffaudiosource("%source_file%")
v=ffvideosource("%source_file%", fpsnum=24000, fpsden=1001)
AudioDub(v, a)

Changing the FFVideoSource filter script in StaxRip to this seems to do the trick for converting variable to constant but now the video never fully converts. It'll convert about half before the audio is dropped and only the audio remains.

Is there a command I'm missing?

elahn
7th February 2017, 20:39
In StaxRip, I'm clicking Filters -> Edit and inserting: , fpsnum=25, fpsden=1 into the ffms2 Source. So the whole line reads:

clip = core.ffms2.Source(r"%source_file%", cachefile = r"%temp_file%.ffindex", fpsnum=25, fpsden=1)

This is for a VFR x264 (mkv) -> CFR x265 (mkv) conversion and is working perfectly. I'm using VapourSynth and I updated mkvextract & mkvmerge to the latest MkvToolNix, but I'm not sure that's relevant.