Question about framerate
I have a question about frame rate.
I want to encode raw video to h264 with 30 fps. So I run the h264enc with configuration files that are set FrameRateIn and FrameRateOut 30. (using binary built from openh264v1.1) But ffprove command replies 25 fps. Is there anything wrong?
I will appreciate your help with this situation.
$ h264enc welsconf.cfg
$ ffprove output.264
ffprobe version 2.4- http://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2014 the FFmpeg developers
built on Sep 15 2014 20:08:17 with gcc 4.8 (Debian 4.8.3-10)
configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Input #0, h264, from 'output.264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 720x932, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Here is my configuration files. welsenc.cfg
#============================== GENERAL ==============================
UsageType 0 #0: camera video 1:screen content
SourceWidth 720 # Input frame width
SourceHeight 932 # Input frame height
InputFile output.yuv
OutputFile output.264 # Bitstream file
MaxFrameRate 30 # Maximum frame rate [Hz]
FramesToBeEncoded -1 # Number of frames (at input frame rate), -1
TemporalLayerNum 3 # temporal layer number(1--4)
IntraPeriod 0 # Intra Period ( multipler of GoP size or -1)
EnableSpsPpsIDAddition 1
EnableFrameCropping 1 # enable frame cropping flag
MaxNalSize 0 # Unit:Byte, Maximum Nal size
#============================== LOOP FILTER ==============================
LoopFilterDisableIDC 0 # Loop filter idc (0: on, 1: off,
#2: on except for slice boundaries,
#3: two stage. slice boundries on in second stage
#4: Luma on but Chroma off (w.r.t. idc=0)
#5: Luma on except on slice boundaries, but Chroma off in enh. layer (w.r.t. idc=2)
#6: Luma on in two stage. slice boundries on in second stage, but Chroma off (w.r.t. idc=3)
LoopFilterAlphaC0Offset 0 # AlphaOffset(-6..+6): valid range
LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
#============================== SOFTWARE IMPLEMENTATION ==============================
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
#============================== RATE CONTROL ==============================
RCMode 0 # 0: quality mode; 1: bitrate mode; 2: bitrate limited mode;
#3: buffer based mode,can't control bitrate; -1: rc off mode;
TargetBitrate 2600 # Unit: kbps, controled by EnableRC also
MaxOverallBitrate 2600 # Unit: kbps, max bitrate overall
#============================== DENOISE CONTROL ==============================
EnableDenoise 1 # Enable Denoise (1: enable, 0: disable)
#============================== SCENE CHANGE DETECTION CONTROL =======================
EnableSceneChangeDetection 1 # Enable Scene Change Detection (1: enable, 0: disable)
#============================== BACKGROUND DETECTION CONTROL ==============================
EnableBackgroundDetection 1 # BGD control(1: enable, 0: disable)
#============================== ADAPTIVE QUANTIZATION CONTROL =======================
EnableAdaptiveQuantization 1 # Enable Adaptive Quantization (1: enable, 0: disable)
#============================== LONG TERM REFERENCE CONTROL ==============================
EnableLongTermReference 1 # Enable Long Term Reference (1: enable, 0: disable)
LtrMarkPeriod 30 # Long Term Reference Marking Period
#============================== LAYER DEFINITION ==============================
PrefixNALAddingCtrl 0 # Control flag of adding prefix unit (0: off, 1: on) # It shall always be on in SVC contexts (i.e. when there are CGS/MGS/spatial enhancement layers)
# Can be disabled when no inter spatial layer prediction in case of its value as 0
NumLayers 1 # Number of layers
LayerCfg layer.cfg # Layer 2 configuration file
layer.cfg
#============================== INPUT / OUTPUT ==============================
FrameWidth 720 # Input frame width
FrameHeight 932 # Input frame height
FrameRateIn 30 # Input frame rate [Hz]
FrameRateOut 30 # Output frame rate [Hz]
ReconFile rec_layer2.yuv # Reconstructed file
#============================== CODING ==============================
ProfileIdc 66 # value of profile_idc (or 0 for auto detection)
InitialQP 26 # Quantization parameters for base quality layer
#================================ RATE CONTROL ===============================
SpatialBitrate 2600 # Unit: kbps, controled by DisableRC also
MaxSpatialBitrate 2600 # Unit: kbps, max bitrate for current layer
#============================== MultiSlice Slice Argument ==============================
# for S/M Slice(s) mode settings
SliceMode 0 # 0: sigle slice mode; >0: multiple slices mode, see below;
SliceSize 1500
SliceNum 1 # multiple slices number specified
SlicesAssign0 960 # count number of MBs in slice #0
SlicesAssign1 0 # count number of MBs in slice #1
SlicesAssign2 0 # count number of MBs in slice #2
SlicesAssign3 0 # count number of MBs in slice #3 -- seting here is for better testing
SlicesAssign4 0 # count number of MBs in slice #4
SlicesAssign5 0 # count number of MBs in slice #5
SlicesAssign6 0 # count number of MBs in slice #6
SlicesAssign7 0 # count number of MBs in slice #7
Hi ysksuzuki, OpenH264 encoder actually did not add VUI info in the bit stream, in other words, it does not contain frame rate info in bit stream.
Hello sijchen, thank you for replying. So the value 25fps that ffprove replies is default. I understand it.
I have the very same problem. I am encoding from an application at 30 fps, and the decoder application detects only 25fps. Consequently it cannot decode at the same speed so there is an increasing delay (up to minutes).
Any tips? I can open another issue for this.
~~Update: setting rate control to RC_TIMESTAMP_MODE fixed this. It was set to RC_QUALITY_MODE~~ Keep it up openh264!
Actually that was not the case. There was an initialization error and my program used a different encoder. The decoder program still detects 25 fps when my bitstream should be of 30 fps.