Frame Rate
jazzjackrabb1t opened this issue · 8 comments
In the encoding options, FrameRate fields type is integer. Should It be float32 rather than int? I think, FPS value has not be integer. When I use openCV with this API, my camera's fps is 29.00009. It is ok to round the fps value for this case. But every camera devices have different fps value.
Thanks,
x264 param has this IFpsNum uint32
in param, and int is converted to uint32. Do you have any issues with this? You can round however you want and pass that to options.
I have more or less the same problem; I'm reading metadata from video file A and using x264-go to write out video file B with overlay data that I can put on top of it in an editor.
In the US, very little video actually uses an integer framerate. My current source is 29.97, and none of my camera's options give an integer frame rate. Thanks to NTSC, most frame rates are 1000/1001th of what you'd expect.
Frame rates are basically fiction, and it's easy enough to clean it up after, but it'd be nice to be able to be correct right out of the gate.
x264 API uses uint32, I cannot change that. You are in control, check camera fps, round numbers as you like and just pass that to encoder.
It looks like x264 actually wants a rational number, via i_fps_num and i_fps_den. I want 30000 / 1001. Options.FrameRate feeds to i_fps_num, but i_fps_den is always 1. I'll consider a PR for that in a bit, once I get my code actually working.
Also, at least for my example, it doesn't actually matter what I set, because I always get 25 FPS in the generated file.
opts := &x264.Options{
Width: 1280,
Height: 720,
FrameRate: 60,
Preset: "veryfast",
Profile: "high",
LogLevel: x264.LogDebug,
}
$ ffprobe overlay.264
ffprobe version 4.3.2-0+deb11u1ubuntu1 Copyright (c) 2007-2021 the FFmpeg developers
...
Input #0, h264, from 'overlay.264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
I'll dig into that as well.
I always get 25 fps no matter what.
same issue I am also facing