Compiling custom cap_ffmpeg_impl.hpp

asked 2020-03-25 07:04:57 -0600

Dronzer gravatar image

updated 2020-03-25 08:19:10 -0600

I have edited cap_ffmpeg_impl.hpp by setting some parameters and print statements. I am compiling the libraries from the souce files. The compilation was successful but the changes in the file are not registered. I am wondering if any one could guide me on this?

Platform Windows 32-bit Opencv 4.2.0

FFMPEG:                      YES (prebuilt binaries)
  avcodec:                   YES (58.54.100)
  avformat:                  YES (58.29.100)
  avutil:                    YES (56.31.100)
  swscale:                   YES (5.5.100)
  avresample:                YES (4.0.0)

Here is the change that I wish to add:

if LIBAVUTIL_BUILD > CALC_FFMPEG_VERSION(51,11,0)

/* Some settings for libx264 encoding, restore dummy values for gop_size
 and qmin since they will be set to reasonable defaults by the libx264
 preset system. Also, use a crf encode with the default quality rating,
 this seems easier than finding an appropriate default bitrate. */
if (c->codec_id == AV_CODEC_ID_H264) {
  c->gop_size = -1;
  c->qmin = -1;

  c->bit_rate = 500;
  if (c->priv_data)
  {
    av_opt_set(c->priv_data,"crf","0", 0);
    av_opt_set(c->priv_data,"preset","ultrafast", 0);
  }
     // av_opt_set(c->priv_data,"crf","23", 0);
}

endif

edit retag flag offensive close merge delete

Comments

are you sure, you're using your updated opencv_videoio.dll ? did you (re)build the INSTALL project ? look at timestamps

(if you edit some header in the src tree -- it's not the same as in the final install, so you need to retake all those steps as in your original build)

berak gravatar imageberak ( 2020-03-25 07:42:55 -0600 )edit

I have rebuild the INSTALL project but it didn't help. I am currently using cmake-gui. o I have to mention CMAKE_INSTALL_PREFIX=/modules/videoio/ into the configuration?

Dronzer gravatar imageDronzer ( 2020-03-25 07:46:14 -0600 )edit

I have also checked the timestamps and they belong to new built.

Dronzer gravatar imageDronzer ( 2020-03-25 07:47:01 -0600 )edit

imho you should leave CMAKE_INSTALL_PREFIX as is (opencv/build/install), you probably have the PATH env already pointing at it (where it will look for dlls)

berak gravatar imageberak ( 2020-03-25 09:47:23 -0600 )edit

Yes, I have done that but it didnot help. Do I have to build ffmpeg libraries from Scratch?

Dronzer gravatar imageDronzer ( 2020-03-25 10:01:59 -0600 )edit

Just now, tried compiling with an empty opencv_ffmpeg_impl.hpp but still compiles. is it because of FFMPEG prebuilt binaries?

Dronzer gravatar imageDronzer ( 2020-03-26 11:35:43 -0600 )edit