Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Videos: ffmpeg framerate (-r) option incorrect when using h264_nvenc #2442

Closed
abgd1234 opened this issue Jun 18, 2022 · 2 comments
Closed

Videos: ffmpeg framerate (-r) option incorrect when using h264_nvenc #2442

abgd1234 opened this issue Jun 18, 2022 · 2 comments
Assignees
Labels
bug Something isn't working help wanted Well suited for external contributors! video Video Formats, Transcoding, FFmpeg, Streaming & Co

Comments

@abgd1234
Copy link
Contributor

When NVENC is used, the call to ffmpeg sets the framerate to 30 before -i. This causes ffmpeg to interpret the input video as 30fps, even when it isn't.

case NvidiaEncoder:
// ffmpeg -hide_banner -h encoder=h264_nvenc
result = exec.Command(
ffmpegBin,
"-r", "30",
"-i", fileName,

To fix this, "-r", "30", should be placed after "-i", fileName, in line with the other non-NVENC cases.

@lastzero
Copy link
Member

This is generally intended to limit the size and bitrate of the transcoded version as 4K 60fps videos are HUGE, especially when using a less efficient encoder. We welcome a pull request to update the command so it meets that goal should this currently not be the case.

@lastzero lastzero added bug Something isn't working needs-analysis Requires further investigation help wanted Well suited for external contributors! labels Jun 18, 2022
@abgd1234
Copy link
Contributor Author

The issue is that the input file rather than the output file is specified as 30fps. For example, a 15fps input video will be treated as 30fps, and the transcoded output video will then run twice as fast. This is simply a bug - all the other encoder cases correctly place "-r", "30", after the input file.

I have submitted pull request #2449 to fix this.

@lastzero lastzero added please-test Ready for acceptance test and removed needs-analysis Requires further investigation labels Jun 19, 2022
@lastzero lastzero added video Video Formats, Transcoding, FFmpeg, Streaming & Co and removed please-test Ready for acceptance test labels Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Well suited for external contributors! video Video Formats, Transcoding, FFmpeg, Streaming & Co
Projects
Status: Release 🌈
Development

No branches or pull requests

2 participants