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

make VideoWriter::open() print out all appropriate fourcc codes #12472

Open
duanegi opened this issue Sep 8, 2018 · 0 comments
Open

make VideoWriter::open() print out all appropriate fourcc codes #12472

duanegi opened this issue Sep 8, 2018 · 0 comments

Comments

@duanegi
Copy link

duanegi commented Sep 8, 2018

System information (version)
  • OpenCV => 3.4.0
  • Operating System / Platform => all
  • Compiler => all
Detailed description

Figuring out what fourcc codes one can use is a pain.
If would be great is VideoWriter::open could return all the possible codes or at least print them them out.

A very simple way would be to print the codes to stdout if a fourcc == -1 is given/

Steps to reproduce

The change would seem to be in cap_ffmpeg_impl.hpp ( CvVideoWrite_FFMPEG::open )

1914d1913
< 
1921,1959d1919
<     // need to define fallback_tags earlier
<             const struct AVCodecTag * fallback_tags[] = {
< #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
< // APIchanges:
< // 2012-01-31 - dd6d3b0 - lavf 54.01.0
< //   Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
<                 avformat_get_riff_video_tags(),
< #endif
< #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 25, 100) && defined LIBAVFORMAT_VERSION_MICRO && LIBAVFORMAT_VERSION_MICRO >= 100
< // APIchanges: ffmpeg only
< // 2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h
< //   Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags().
<                 avformat_get_mov_video_tags(),
< #endif
<                 codec_bmp_tags, // fallback for avformat < 54.1
<                 NULL };
< 
<     if (fourcc==-1 || fourcc == CV_FOURCC('#','#','#','#')){
<       const AVCodecTag *const *chk_tags = fallback_tags;
<       std::string tag_type = "fallback";
<       if (fmt && fmt->codec_tag){
< 	chk_tags = fmt->codec_tag;
< 	tag_type = "extension based";
<       }
<       int i;
<       fflush(stdout);
<       for (i = 0; chk_tags && chk_tags[i]; i++) {
< 	const AVCodecTag *tags = chk_tags[i];
< 	while(tags->id != AV_CODEC_ID_NONE){
< 	  fprintf(stdout,"%s: codec_id=%x fourc=%c%c%c%c\n",
< 		  tag_type.c_str(),tags->id,
< 		  CV_TAG_TO_PRINTABLE_CHAR4(tags->tag));
< 	  tags++;
< 	}
<       }
<       fflush(stdout);
<       return false;
<     }
<     
1978a1938,1952
>         const struct AVCodecTag * fallback_tags[] = {
> #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
> // APIchanges:
> // 2012-01-31 - dd6d3b0 - lavf 54.01.0
> //   Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
>                 avformat_get_riff_video_tags(),
> #endif
> #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 25, 100) && defined LIBAVFORMAT_VERSION_MICRO && LIBAVFORMAT_VERSION_MICRO >= 100
> // APIchanges: ffmpeg only
> // 2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h
> //   Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags().
>                 avformat_get_mov_video_tags(),
> #endif
>                 codec_bmp_tags, // fallback for avformat < 54.1
>                 NULL };

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

2 participants