View Full Version : Handbrake & Variable Framerate...


sundance
3rd June 2011, 15:03
Hi experts,

since some time, my BD encodings done with HandBrake (framerate set to "same as source") end up indicated as "variable framerate" when inspected with MediaInfo. I've read in various threads here and elsewhere that this information is not always correct but sometime causes playback problems with some media players (e.g. WDTV).

I would like to know:
- How can I tell for sure if my backup is vfr? (MediaInfo just says "vfr" and framrate = 23.976 but no minimum/maximum framerate) - so maybe this is just kinda (wrong) flag but the movie is constant 23.976 fps.
- If this is the case, could this flag be removed by just remuxing the mkv file with mkvmerge and specifying 23.976 fps without side effects?
Of course, I still have the BDs and could encode the movies once again; still this takes a lot of time....

.sundance.

sundance
28th June 2011, 11:34
(...) could this flag be removed by just remuxing the mkv file with mkvmerge and specifying 23.976 fps
Found out that this procedure is not working. Since the h.264 elementary stream is flaged VFR, the resulting MKV is too.
How can this issue (CFR video @23.976fps incorrectly flaged VFR) being fixed?

.sundance.

manolito
28th June 2011, 13:20
Do not use 'Same as source' for the framerate. Specify a fixed framerate instead (like 23.976).

For an in depth explanation have a look here:
https://trac.handbrake.fr/wiki/Telecine#detelecine


Cheers
manolito

sneaker_ger
28th June 2011, 14:14
Yes, I think manolito is correct.
If you want to "fix" your already encoded files you can try this ffmpeg build (http://forum.doom9.org/showthread.php?t=152419).

Lighto
28th June 2011, 14:28
Hope I am not thread hijacking but according to this link

https://trac.handbrake.fr/wiki/VariableFrameRate

If a source is entirely hard telecined from beginning to end, you can convert it from 30fps to 24fps, recreating the original film speed and frame order.

The difficult part is, most sources aren't entirely telecined. Parts will be supposed to run at 30fps. Other parts can be safely brought down to 24fps. For example, title cards might have been done on a computer at 30fps, while live-action material was shot with a film camera at 24fps and then telecined. Other times, part might be progressive 24fps (soft telecined).

If you bring the entire source up to 24 frames per second, the part that is supposed to run at 30fps will be displayed too slowly. If you bring the entire source down to 30 frames per second, the part that is supposed to run at 24fps will appear jerky.

The solution is to leave everything at the speed it was meant to play at. 30fps for 30fps stuff, 24fps for 24fps stuff. Leave the soft telecined parts progressive, detelecine the hard telecined parts to be progressive. When this is done within one movie file, it's called variable frame rate. The frames per second vary between 24 and 30. A place for everything, and everything in its place.

If I encode a similar source with other encoding GUI using QTGMC , will I end up with VFR like HandBrake?

If not, does that mean that the output of the encoding GUI is not as smooth in terms of playback compared to HandBrake?

sundance
29th June 2011, 08:38
Thanks to everyone for your valuable input.

@Manolito:
Do not use 'Same as source' for the framerate. Specify a fixed framerate instead (like 23.976)Yes, I know by now... Newer encodings are done properly, but some accidentally were done with "same as source" setting which worked for quite a while.

@sneaker_ger:
The tool you mentioned looks very promising!
A short test file (mkv) converts fine to CFR with this command line:
ffmpeg.exe -i test-crf18-vfr.mkv -vcodec copy -an -vbsf h264_changesps=cfr/fps=24000:1001 outfile.mkv

But somehow I failed when I tried to copy the audio track(s) (DTS@1510 kbps) along with the video:

ffmpeg.exe -i test-crf18-vfr.mkv -vcodec copy -acodec copy -vbsf h264_changesps=cfr/fps=24000:1001 outfile.mkv
ffmpeg version git-N-29946-g27614b1, Copyright (c) 2000-2011 the FFmpeg developers
built on May 16 2011 01:30:32 with gcc 4.4.5
configuration:
libavutil 51. 2. 1 / 51. 2. 1
libavcodec 53. 5. 0 / 53. 5. 0
libavformat 53. 0. 3 / 53. 0. 3
libavdevice 53. 0. 0 / 53. 0. 0
libswscale 0. 14. 0 / 0. 14. 0
[matroska,webm @ 003e5170] max_analyze_duration reached
[matroska,webm @ 003e5170] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 1000.00 (1000/1)
Input #0, matroska,webm, from 'test-crf18-vfr.mkv':
Duration: 00:06:04.62, start: 0.000000, bitrate: N/A
Stream #0.0(eng): Video: h264 (High), yuv420p, 1280x546, PAR 1:1 DAR 640:273, 23.98 fps, 1k tbr, 1k tbn, 180k tbc (default)
Stream #0.1(ger): Audio: [0][0][0][0] / 0x0000, 6 channels (default)

[matroska @ 01103010] sample rate not set

Output #0, matroska, to 'outfile.mkv':
Stream #0.0(eng): Video: H264 / 0x34363248, yuv420p, 1280x546 [PAR 1:1 DAR 6
40:273], q=0-0, 90k tbn, 23.98 tbc (default)
Stream #0.1(ger): Audio: [0][0][0][0] / 0x0000, 6 channels (default)
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Could not write header for output file #0 (incorrect codec parameters ?)

What sample rate has to be specified and how?