Author Topic: x264 Framerate Always 25fps  (Read 964 times)

Offline technomorph

  • Member
  • Posts: 3
    • View Profile
x264 Framerate Always 25fps
« on: June 19, 2012, 10:55:57 AM »
Hi,

I am attempting to encode an elementary h264 stream demuxed using tsmuxer. I am using the latest x264 Windows build found here: http://x264.nl/.

Here is the MediaInfo data for the source file:

Code: [Select]
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Bit rate mode                            : Variable
Maximum bit rate                         : 35.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 23.976 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Color primaries                          : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

I have used the following command line options as found here https://sites.google.com/site/x264bluray/home/1080i-p:

Code: [Select]
x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 1 -o out.264 input.file

x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 2 -o out.264 input.file

My problem is that no matter what I do, x264 always encodes using 25fps instead of 23.976fps (as per the source file). The x264 settings info (http://mewiki.project357.com/wiki/X264_Settings) states that the framerate from the source file should be used, but this does not happen. I have tried using the following to no avail as well:

Code: [Select]
--fps 24000/1001 --force-cfr
I have had a good look through various forums and Google but cannot find a solution.

Any assistance is gratefully received.

Cheers

Offline J_Darnley

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • View Profile
Re: x264 Framerate Always 25fps
« Reply #1 on: June 19, 2012, 02:33:33 PM »
What says the output is 25 fps?  If the framerate of the input can be found it will be used, otherwise x264 will fallback to 25.  But forcing the framerate with --fps always works.

If you are muxing that elementary stream (.264) you're writing, are you setting the framerate correctly?  I seem to recall that mkvmerge uses 25 for elementary streams.
Knowledgeable about: cmd.exe, ffmpeg, x264

Offline technomorph

  • Member
  • Posts: 3
    • View Profile
Re: x264 Framerate Always 25fps
« Reply #2 on: June 19, 2012, 05:39:48 PM »
This is the first-line output when executing x264 using the standard command line options (i.e. fps not specified):

Code: [Select]
ffms [info]: 1920x1080p 1:1 @ 25/1 fps (vfr)
This is the first-line output when executing using the --fps 24000/1001 --force-cfr command line options:

Code: [Select]
ffms [info]: 1920x1080p 1:1 @ 25/1 fps (cfr)
Like I say, x264 always seems to use 25 fps regardless. I'm sure there is a very sensible reason for it doing this, however what I didn't mention in my first post is that this particular workflow was working correctly for me up until a few months back when I started using a later version of x264. This isn't a show-stopper because I can change the fps when muxing the stream with tsmuxer, i'm just a bit confused as to why things changed. I must be missing something.



Offline Groucho2004

  • Member
  • Posts: 54
    • View Profile
Re: x264 Framerate Always 25fps
« Reply #3 on: June 19, 2012, 06:12:27 PM »
I just ran a few tests - yes, no matter what, it displays "25/1" while encoding. However, the encoded stream has the correct frame rate.

Offline technomorph

  • Member
  • Posts: 3
    • View Profile
Re: x264 Framerate Always 25fps
« Reply #4 on: June 20, 2012, 04:00:07 PM »
For the benefit of anyone reading this thread, I just ran a couple of tests which partially agree with the above. Setting the frame rate explicitly using the options --fps 24000/1001 --force-cfr does encode using the target frame rate (despite x264 implying otherwise). However, for the source file I am using at least, not specifying the frame rate still results in the default 25 fps being used. This seems to be at odds with what's stated in the settings info. It may be something to do with the source file being an elementary .264 stream. Either way, the fact that x264 reports 25 fps irrespective of source fps is somewhat confusing.

Offline kemuri-_9

  • Compiling Encoder
  • Member
  • Posts: 269
    • View Profile
Re: x264 Framerate Always 25fps
« Reply #5 on: June 20, 2012, 05:21:57 PM »
It sounds like you're encoding from that .h264 file that was demuxed.
my understanding is that .h264/.264 files are always assumed to be 25fps by ffmpeg/libav.
because you demuxed it, the original 24000/1001 framerate was lost.