Selur's Little Message Board
Encoding Video at Constant Frame Rate - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: Encoding Video at Constant Frame Rate (/thread-1630.html)



Encoding Video at Constant Frame Rate - Dan64 - 08.12.2020

I need to convert a video with CFR from 23.976 fps to 25 fps

To do that I set Filtering->Speed Change->Change speed to 25 fps. Moreover I set the filter for the Audio settings to do the same adjustment.

These settings are working as expected. Now my problem is the following:

If I use as container MKV, I get a correct video with a constant frame rate (CFR) of 25fps. But If I use as container MP4 I obtain a wrong video (are generate more frames than the original and the audio is out of sync). To fix the problem I need to check the flag Config->Containers->Mp4 Settings->FFmpeg instead of MP4Box. With this fix I obtain a video at 25fps with the audio in sync. The only problem left is that I obtain a variable frame rate (VFR) of 25fps, while I would prefer a CFR output. I enabled the Input->Decoding->CFR output, but the output don't change is still VFR. I think that is a problem of container because using MKV the output is the right one.

There are some more options that i can use ?


RE: Encoding Video at Constant Frame Rate - Selur - 08.12.2020

I can't reproduce this here.
When I load a cfr 23.976 fps video and use "Filtering->Speed Change->Change speed" to speed it up to 25fps I end up with 25fps cfr video.
Hybrid should only output vfr if the source is already vfr. -> Are you sure your video is 23.976 cfr and not 29.976fps telecined content?
Without any details about your source and no debug output of what you are doing: No clue

Also if your audio was synced against the initial 23.976fps video (and not stretched or anything), speeding up the video would cause an async output, since the playback speed of the video stream (and thus it's playback length) would be changed, but the audio stream length would still be the same
Seems to me that you described only half of what you are doing.

Quote:I need to convert a video with CFR from 23.976 fps to 25 fps
In general this can be archived by:
a. speeding up audio&video playback speed (and thus shorten the playback length)
b. adding additional frames to the video stream (by duplication or interpolation) and not touching the audio.
c. when using mkv one could change the playback speed of the audio and video without re-encoding (changing the frame rate info of the video and adjusting the audio stretch factor of the audio)


Cu Selur


RE: Encoding Video at Constant Frame Rate - Dan64 - 09.12.2020

I followed the steps described in this post: https://forum.selur.net/showthread.php?tid=525

Investigating more on this problem I noted that if I convert the "mp4" output using MKVtoolnix in "mkv" the movie is identified as a constant frame rate.

This is the output of Mediainfo on mp4 file:

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L4.1
Format settings             : CABAC / 4 Ref Frames
Format settings, CABAC      : Yes
Format settings, Reference  : 4 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 1 h 29 min
Duration_FirstFrame         : -14 ms
Bit rate                    : 4 148 kb/s
Width                       : 1 280 pixels
Height                      : 960 pixels
Display aspect ratio        : 4:3
Frame rate mode             : Variable
Frame rate                  : 25.000 FPS
Minimum frame rate          : 21.262 FPS
Maximum frame rate          : 25.000 FPS

But when I convert the container to mkv, the Mediainfo of mkv file is:

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L4.1
Format settings             : CABAC / 4 Ref Frames
Format settings, CABAC      : Yes
Format settings, Reference  : 4 frames
Codec ID                    : V_MPEG4/ISO/AVC
Duration                    : 1 h 29 min
Bit rate                    : 4 148 kb/s
Width                       : 1 280 pixels
Height                      : 960 pixels
Display aspect ratio        : 4:3
Frame rate mode             : Constant
Frame rate                  : 25.000 FPS

So I don't think that is really VFR, but in any case is not really a problem. I'm happy with this solution.


RE: Encoding Video at Constant Frame Rate - Selur - 09.12.2020

Thanks for the info, I'll try to reproduce the issue here.

Cu Selur


RE: Encoding Video at Constant Frame Rate - Selur - 09.12.2020

Can you create a debug output when doing, what you do? (I can't reproduce the vfr effect here.)
Only thing I found so far is that FFmpeg can't change the video frame rate during remuxing, so "FFmpeg instead of MP4Box" is definitely wrong. (I modified Hybrid to not create the jobs on passthrough video if the frame rate should change.)

Cu Selur


RE: Encoding Video at Constant Frame Rate - Dan64 - 27.12.2020

Sorry for the delay in the answer.

I attached the debug output as requested.

Moreover I included some screenshots of the settings applied for the rate conversion.

Best Regards


RE: Encoding Video at Constant Frame Rate - Selur - 27.12.2020

Don't see a problem with the calls.
Hybrid does not add vfr time codes.
Only thing 'uncommon' is that ffmpeg being used for mkv muxing:
"D:\Programs\Hybrid\64bit\ffmpeg.exe" -y -threads 8 -i "F:\VideoTests\Encoders\Magnum\Input.23fp_BD.1080p.10bit.AAC.2.0.x265_5m.mkv" -map 0:1 -vn -sn -acodec copy -map_metadata -1 -metadata encoding_tool="Hybrid 2020.10.11.1" "F:\VideoTests\Encoders\Magnum\iId_6_aid_0_lang_en_DELAY_-33ms_2020-12-27@09_10_12_3910_01.aac"
so may be MediaInfo has a problem with that.
-> update you Hybrid, check that you haven't enabled 'Config->Container->FFmpeg for .mkv muxing'

Cu Selur