Frame Rate Mode changing to Variable

Any other question that don't fit into the other support categorizes.
Post Reply
olpdog
Posts: 3
Joined: Sun Nov 04, 2018 2:29 am

Frame Rate Mode changing to Variable

Post by olpdog » Sun Nov 04, 2018 3:00 am

I am having an issue with some mp4 files I am attempting to compress into an mkv container using ffmpeg. Here is the original video's MediaInfo:

Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/mp41)
File size : 1.15 GiB
Duration : 42 min 33 s
Overall bit rate mode : Variable
Overall bit rate : 3 871 kb/s
Writing application : Lavf57.71.100
Cover : Yes

Video
ID : 1
Format : MPEG-4 Visual
Format profile : [email protected]
Format settings, BVOP : No
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Codec ID : mp4v-20
Duration : 42 min 33 s
Bit rate mode : Variable
Bit rate : 3 735 kb/s
Maximum bit rate : 29.1 Mb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.162
Stream size : 1.11 GiB (96%)
Writing library : Lavc57.89.100

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 42 min 33 s
Duration_LastFrame : -1 ms
Bit rate mode : Variable
Bit rate : 132 kb/s
Maximum bit rate : 154 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 39.9 MiB (3%)
Default : Yes
Alternate group : 1

When I use FFmpeg to convert the video using a simple command set (ie; ffmpeg -i original.mp4 -vf scale=1280:720 -crf 18 -c:a copy original.mkv), the frame rate mode is changing from "Constant" to "Variable" (I shut it off after 1 min, but the variable frame rate mode happens if I finish out the full convert).

Format : Matroska
Format version : Version 4
File size : 18.6 MiB
Duration : 1 min 6 s
Overall bit rate : 2 367 kb/s
Writing application : Lavf58.19.101
Writing library : Lavf58.19.101
ErrorDetectionType : Per level 1

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 min 5 s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Default : Yes
Forced : No

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : A_AAC-2
Duration : 1 min 6 s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Default : Yes
Forced : No

If I leave the audio completely out of the equation (ie; ffmpeg -i original.mp4 -vf scale=1280:720 -crf 18 original.mkv), I get this:

Format : Matroska
Format version : Version 4
File size : 17.5 MiB
Duration : 1 min 3 s
Overall bit rate mode : Variable
Overall bit rate : 2 311 kb/s
Writing application : Lavf58.19.101
Writing library : Lavf58.19.101
ErrorDetectionType : Per level 1

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 min 3 s
Bit rate : 2 153 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.093
Stream size : 16.2 MiB (93%)
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Default : Yes
Forced : No

Audio
ID : 2
Format : Vorbis
Format settings, Floor : 1
Codec ID : A_VORBIS
Duration : 1 min 3 s
Bit rate mode : Variable
Bit rate : 112 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 866 KiB (5%)
Writing application : Lavc58.33.102
Writing library : libVorbis (Now 100% fewer shells) (20180316 (Now 100% fewer shells))
Default : Yes
Forced : No

The video is correct, but the audio has been converted to vorbis. I just want to make an .mkv file with a constant frame rate that leaves the AAC audio untouched. I have tried altering the audio and using the -r command, but I continue getting the variable frame rate every time I include the audio in the command. Any assistance would be greatly appreciated. Thank you

pandy
Posts: 200
Joined: Mon Feb 24, 2014 1:46 pm

Re: Frame Rate Mode changing to Variable

Post by pandy » Sat Nov 17, 2018 2:18 pm

setup video encoder properly, never rely on default codec setting for particular container.
To force libx264 constant frame encoding use something like where 'force_cfr=1' means constant frame rate:

Code: Select all

@SET x264opts="crf=23:level=4.0:qpmin=12:vbv_maxrate=20000:vbv_bufsize=10000:ref=3:bframes=3:rc-lookahead=30:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709"

Post Reply
'