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

Support custom options in AVCodecContext (av_dict_set) in FFMPEG backend #6342

Open
peters opened this issue Mar 29, 2016 · 2 comments
Open

Comments

@peters
Copy link
Contributor

peters commented Mar 29, 2016

I'm looking for guidance in regards to submitting a PR that will allow you to specify raw options (i.e preset) using av_dict_set. This applies to VideoCapture and VideoWriter The use case here being that you could support encoding videos targeting a specific device (i.e Apple iPad). Or tune encoding performance for a given codec i.e. VP9

Specify backend options by instantiating a new VideoWriter (!?)

VideoWriter::VideoWriter(const String& filename, int fourcc, double fps, Size frameSize, bool isColor=true, std::map<std::string, std::string> backendOptions)
@alalek
Copy link
Member

alalek commented Mar 29, 2016

We prefer do not use STL classes in exported functions/methods (ABI is different in many cases, for example Debug/Release MSVS builds, moreover FFMPEG wrapper is build via MINGW tools, so it will not work). (upd 2019/12/06: not actual anymore, but bindings and wrapper API should be adopted)

What is about of using environment variable and parse passed value via av_dict_parse_string call in cap_ffmpeg_impl.hpp?

Suggested names:

  • OPENCV_VIDEOWRITER_FFMPEG_OPTIONS OPENCV_FFMPEG_WRITER_OPTIONS
  • OPENCV_VIDEOCAPTURE_FFMPEG_OPTIONS OPENCV_FFMPEG_CAPTURE_OPTIONS (currently we have forced hack with "rtsp_transport=tcp")

Suggested format:

param1=value1,param2=value2

BTW, Could you add link or example with useful parameters and possible values (to select appropriate keys/values separators)?


Related patch for VideoCapture + OPENCV_FFMPEG_CAPTURE_OPTIONS: #9292

@grzegorzk
Copy link

Hi @alalek , I browse the repository and can see OPENCV_FFMPEG_CAPTURE_OPTIONS env in there, but not OPENCV_FFMPEG_WRITER_OPTIONS - is the former applied to both VideoReader and VideoWriter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants