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

libav codec options #608

Merged
merged 2 commits into from
Nov 22, 2023
Merged

libav codec options #608

merged 2 commits into from
Nov 22, 2023

Conversation

popsUlfr
Copy link
Contributor

This feature allows for specifying libav codec options.

AV1 encoding example with maximum encoding speed and low_latency on:

libcamera-vid -t 10000 --width 1280 --height 720 --framerate 30 --codec libav --libav-video-codec librav1e --libav-video-codec-opts "speed=10;rav1e-params=low_latency=true" -o video.webm

HEVC encoding example with ultrafast preset and main profile:

libcamera-vid -t 10000 --width 1280 --height 720 --framerate 30 --codec libav --libav-video-codec libx265 --libav-video-codec-opts "profile=main;preset=ultrafast" -o video.ts

H264 encoding example with the ultrafast preset, high profile and level 4.2:

libcamera-vid -t 10000 --width 1280 --height 720 --framerate 30 --codec libav --libav-video-codec libx264 --libav-video-codec-opts "preset=ultrafast;profile=high;level=4.2" -o video.ts

I've moved encoderOptionsGeneral() under the specific encoder settings so that they can be overridden on the command line.

@naushir
Copy link
Collaborator

naushir commented Nov 22, 2023

@popsUlfr, would you be able to format the commit messages to <= 80 character width lines and add a Signed-off-by: your name <your email> line at the end for consistency please?

Otherwise, we are good to merge this in!

@popsUlfr
Copy link
Contributor Author

@popsUlfr, would you be able to format the commit messages to <= 80 character width lines and add a Signed-off-by: your name <your email> line at the end for consistency please?

Otherwise, we are good to merge this in!

Yeah sure no problem, give me some time to do just that. I'll also add a note about the default codec options in the help.

A new command line argument '--libav-video-codec-opts'
makes it possible to specify libav codec options.
e.g.:
--libav-video-codec-opts "preset=ultrafast;profile=high;partitions=i8x8,i4x4"

Available options can be queried using 'ffmpeg -h encoder=libx264' for libx264.

Signed-off-by: Philipp Richter <[email protected]>
Test that we can create a raw h264 file using libav with libx264
and codec options correctly.

Signed-off-by: Philipp Richter <[email protected]>
@popsUlfr
Copy link
Contributor Author

Alright, done. Is this OK with you @naushir ?

@naushir
Copy link
Collaborator

naushir commented Nov 22, 2023

Alright, done. Is this OK with you @naushir ?

Yup, all good now! I'll merge this once the tests have finished. Thanks for this useful bit of work!

@naushir naushir merged commit dbe8669 into raspberrypi:main Nov 22, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants