Opened 6 years ago
Closed 3 years ago
#7839 closed defect (fixed)
QVBR breaks mpeg2_qsv
Reported by: | Anton Torp | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avcodec |
Version: | git-master | Keywords: | qsv regression |
Cc: | zhong.li@intel.com | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug: "mpeg2_qsv" is unusable
How to reproduce:
% ffmpeg.exe -y -loglevel debug -hwaccel qsv -i file.mpg \ -c:v mpeg2_qsv test_qvbr.mp4 OK: ffmpeg-20190124-3224d66-win64-static-zeranoe.exe FAIL: ffmpeg-20190125-260f196-win64-static-zeranoe.exe
Up to the 2019-01-24 the encoder "mpeg2_qsv" works without troubles.
From the 2019-01-25 it fails with this error:
[mpeg2_qsv @ 000001c07a8fcd00] Initialized an internal MFX session using hardware accelerated implementation [mpeg2_qsv @ 000001c07a8fcd00] Using the average variable bitrate (AVBR) ratecontrol method [mpeg2_qsv @ 000001c07a8fcd00] Error initializing the encoder: invalid video parameters (-15) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
I suspect the problem is with this patch: "lavc/qsvenc: enable QVBR mode"
https://github.com/FFmpeg/FFmpeg/commit/74cf2dc3ac405c5e55b7ecd4d17b40e26d59eb84
as it touches the generic "qsvenc" used by "h264_enc" (without troubles with it) and the "mpeg2_enc" (that fails).
Please fix the bug!
Change History (26)
follow-up: 2 comment:1 by , 6 years ago
Keywords: | qsv regression added; mpeg2_qsv removed |
---|---|
Priority: | normal → important |
comment:2 by , 6 years ago
Replying to cehoyos:
Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.
Hi,
I already put the relevant info the initial ticket: What executable works, what fails, and the
complete command line.
Anyway, I answer to your recall:
- With "ffmpeg-20190125-260f196-win64-static-zeranoe.exe" and using one of the test files:
C:\ffmpeg\ffmpeg-zeranoe> .\ffmpeg.exe -y -loglevel debug -hwaccel qsv -i "Day-Flight.mpg" -c:v mpeg2_qsv test_qvbr.mp4 ffmpeg version N-93022-g260f1960e7 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (GCC) 20181201 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enabl e-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enab le-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 -- enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc - -enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 44.100 / 58. 44.100 libavformat 58. 26.100 / 58. 26.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 48.100 / 7. 48.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Splitting the commandline. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'qsv'. Reading option '-i' ... matched as input url with argument 'Day-Flight.mpg'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'mpeg2_qsv'. Reading option 'test_qvbr.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option y (overwrite output files) with argument 1. Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: input url Day-Flight.mpg. Applying option hwaccel (use HW accelerated decoding) with argument qsv. Successfully parsed a group of options. Opening an input file: Day-Flight.mpg. [NULL @ 000001c07a8fa800] Opening 'Day-Flight.mpg' for reading [file @ 000001c07a8fb840] Setting default whitelist 'file,crypto' [mpegts @ 000001c07a8fa800] Format mpegts probed with size=2048 and score=50 [mpegts @ 000001c07a8fa800] stream=0 stream_type=1b pid=1e1 prog_reg_desc= [mpegts @ 000001c07a8fa800] stream=1 stream_type=6 pid=1f1 prog_reg_desc= [mpegts @ 000001c07a8fa800] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2 [mpegts @ 000001c07a8fa800] parser not found for codec klv, packets or times may be invalid. [AVBSFContext @ 000001c07a948280] nal_unit_type: 9(AUD), nal_ref_idc: 0 [AVBSFContext @ 000001c07a948280] nal_unit_type: 7(SPS), nal_ref_idc: 3 [AVBSFContext @ 000001c07a948280] nal_unit_type: 8(PPS), nal_ref_idc: 3 [AVBSFContext @ 000001c07a948280] nal_unit_type: 5(IDR), nal_ref_idc: 3 [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001c07a8fb940] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001c07a8fb940] nal_unit_type: 5(IDR), nal_ref_idc: 3 [h264 @ 000001c07a8fb940] Format yuv420p chosen by get_format(). [h264 @ 000001c07a8fb940] Reinit context to 1280x720, pix_fmt: yuv420p [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [h264 @ 000001c07a8fb940] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8fb940] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [mpegts @ 000001c07a8fa800] max_analyze_duration 5000000 reached at 5000000 microseconds st:0 [mpegts @ 000001c07a8fa800] Setting avg frame rate based on r frame rate [mpegts @ 000001c07a8fa800] start time for stream 1 is not set in estimate_timings_from_pts [mpegts @ 000001c07a8fa800] After avformat_find_stream_info() pos: 0 bytes read:2936976 seeks:2 frames:302 Input #0, mpegts, from 'Day-Flight.mpg': Duration: 00:03:14.88, start: 10.000000, bitrate: 4187 kb/s Program 1 Stream #0:0[0x1e1], 302, 1/90000: Video: h264 (Main), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(progressiv e, left), 1280x720, 0/1, 60 fps, 60 tbr, 90k tbn, 180k tbc Stream #0:1[0x1f1], 0, 1/90000: Data: klv (KLVA / 0x41564C4B), 0/1 Successfully opened the file. Parsing a group of options: output url test_qvbr.mp4. Applying option c:v (codec name) with argument mpeg2_qsv. Successfully parsed a group of options. Opening an output file: test_qvbr.mp4. [file @ 000001c07a8fda00] Setting default whitelist 'file,crypto' Successfully opened the file. detected 4 logical cores [h264 @ 000001c07a8ff1c0] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001c07a8ff1c0] nal_unit_type: 8(PPS), nal_ref_idc: 3 Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (mpeg2_qsv)) Press [q] to stop, [?] for help cur_dts is invalid (this is harmless if it occurs once at the start per stream) [NULL @ 000001c07a8fb940] nal_unit_type: 7(SPS), nal_ref_idc: 3 [NULL @ 000001c07a8fb940] nal_unit_type: 8(PPS), nal_ref_idc: 3 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [h264 @ 000001c07a8ff1c0] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a8ff1c0] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001c07a8ff1c0] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001c07a8ff1c0] nal_unit_type: 5(IDR), nal_ref_idc: 3 [h-264 @ 000001c07a8ff1c0] Format yuv420p chosen by get_format(). [h264 @ 000001c07a8ff1c0] Reinit context to 1280x720, pix_fmt: yuv420p cur_dts is invalid (this is harmless if it occurs once at the start per stream) [h264 @ 000001c07a965f40] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a965f40] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [h264 @ 000001c07a9666c0] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a9666c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [h264 @ 000001c07a938180] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a938180] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [h264 @ 000001c07a938900] nal_unit_type: 9(AUD), nal_ref_idc: 0 [h264 @ 000001c07a938900] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2 [graph 0 input from stream 0:0 @ 000001c07ae94f00] Setting 'video_size' to value '1280x720' [graph 0 input from stream 0:0 @ 000001c07ae94f00] Setting 'pix_fmt' to value '0' [graph 0 input from stream 0:0 @ 000001c07ae94f00] Setting 'time_base' to value '1/90000' [graph 0 input from stream 0:0 @ 000001c07ae94f00] Setting 'pixel_aspect' to value '0/1' [graph 0 input from stream 0:0 @ 000001c07ae94f00] Setting 'sws_param' to value 'flags=2' [graph 0 input from stream 0:0 @ 000001c07ae94f00] Setting 'frame_rate' to value '60/1' [graph 0 input from stream 0:0 @ 000001c07ae94f00] w:1280 h:720 pixfmt:yuv420p tb:1/90000 fr:60/1 sar:0/1 sws_param:flag s=2 [format @ 000001c07a902e00] Setting 'pix_fmts' to value 'nv12|qsv' [auto_scaler_0 @ 000001c07b19cc00] Setting 'flags' to value 'bicubic' [auto_scaler_0 @ 000001c07b19cc00] w:iw h:ih flags:'bicubic' interl:0 [format @ 000001c07a902e00] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'for mat' [AVFilterGraph @ 000001c07b3ee2c0] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed [auto_scaler_0 @ 000001c07b19cc00] w:1280 h:720 fmt:yuv420p sar:0/1 -> w:1280 h:720 fmt:nv12 sar:0/1 flags:0x4 [mpeg2_qsv @ 000001c07a8fcd00] Initialized an internal MFX session using hardware accelerated implementation [mpeg2_qsv @ 000001c07a8fcd00] Using the average variable bitrate (AVBR) ratecontrol method [mpeg2_qsv @ 000001c07a8fcd00] Error initializing the encoder: invalid video parameters (-15) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height [AVIOContext @ 000001c07a8fdac0] Statistics: 0 seeks, 0 writeouts [AVIOContext @ 000001c07a903a80] Statistics: 3035280 bytes read, 2 seeks Conversion failed!
comment:3 by , 6 years ago
Hi,
Perhaps I need to comment this: if you change from "-c:v mpeg2_qsv" to "-c:v h264_qsv" then all works (however, compressing with H.264 instead of MPEG-2).
So, the problem is with the "mpeg2_qsv" encoder and not with "generic" qsv encoders. For this reason I recommend to change the keyworks to "mpeg2_qsv regression".
comment:5 by , 6 years ago
Keywords: | mpeg2 added |
---|
comment:6 by , 6 years ago
Keywords: | mpeg2 removed |
---|
comment:7 by , 6 years ago
Replying to atorp:
So, I suggest that the developers include the first part of the patch now, as the part of the code not covered by the QSV_HAVE_CO3 is introduced in this commit:
Done!
https://patchwork.ffmpeg.org/patch/12793/
Regards.
A.H.
follow-up: 9 comment:8 by , 6 years ago
Cc: | added |
---|
Can't reproduce it on my side (Linux), and I don't think the regression is caused by QVBR since your log show that your are working on AVBR mode instead of QVBR.
Probably it is that your MSDK version can't support coding option 3.
- Could you please tell me what is your MSDK API version and library version.
- Apply the patch:
-#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11)
+#define QSV_HAVE_CO3 0
Don't change anything else.
- If it is possible, update your MSDK version can try again.
follow-up: 11 comment:9 by , 6 years ago
Hi,
Replying to lizhong1008:
Can't reproduce it on my side (Linux), and I don't think the regression is caused by QVBR since your log show that your are working on AVBR mode instead of QVBR.
Sorry. I don't commented that I'm using WINDOWS. However, it's implicit as I use "ffmpeg.exe" in the description of the bug.
Futhermore I do all tests with zeranoe binaries. You can download and test by your self.
The versions prior to 2019-01-25 work, but from this date not.
And yes, I'm not using QVBR at all. The problem is that the "mpeg2_qsv" never works after this date. You can use any parameters, it always prints the failure.
Replying to lizhong1008:
Probably it is that your MSDK version can't support coding option 3.
I don't know it! I'm using Windows 10 with the last Intel drivers installed. And the binaries are the "zeranoe".
Replying to lizhong1008:
- Could you please tell me what is your MSDK API version and library version.
- Apply the patch:
-#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11)
+#define QSV_HAVE_CO3 0
Don't change anything else.
- If it is possible, update your MSDK version can try again.
I'll do more tests. But, your suggestion of patch is already included in my previous fix! But it disables at all QVBR.
In any case, please try it on Windows.
Thank you for your support.
comment:10 by , 6 years ago
Hi lizhong1008,
Regarding the Linux / Windows difference, please note this part of code in "libavcodec/qsvenc.h"
#if defined(_WIN32) || defined(__CYGWIN__) #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11) #define QSV_HAVE_MF 0 #else #define QSV_HAVE_AVBR 0 #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 28) #define QSV_HAVE_VCM 0 #define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 28) #define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25) #endif
The problem can definitely appear only in Windows because the compilation is different.
Please test in Windows before anything else!
follow-ups: 12 13 comment:11 by , 6 years ago
Replying to atorp:
Probably it is that your MSDK version can't support coding option 3.
I don't know it! I'm using Windows 10 with the last Intel drivers installed. And the binaries are the "zeranoe".
You can find it with a pure qsv HW transcoding pipeline:
ffmpeg -hwaccel qsv -v verbose -c:v h264_qsv -i input_h264.mp4 -c:v mpeg2_qsv test_qsv.mp4
On my side, I see can the log:
Initialize MFX session: API version is 1.28, implementation version is 1.29
Could you please report what the log on your side to me?
Replying to lizhong1008:
- Could you please tell me what is your MSDK API version and library version.
- Apply the patch:
-#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11)
+#define QSV_HAVE_CO3 0
Don't change anything else.
- If it is possible, update your MSDK version can try again.
I'll do more tests. But, your suggestion of patch is already included in my previous fix! But it disables at all QVBR.
Your previous fix disale two things: both CO3 and QVBR, what is the exact one can fix this problem? CO3 or QVBR, or must disable all of the two?
In any case, please try it on Windows.
Sorry, I have no Windows qsv environment now.
comment:12 by , 6 years ago
Hi lizhong1008,
Replying to lizhong1008:
Replying to atorp:
Probably it is that your MSDK version can't support coding option 3.
I don't know it! I'm using Windows 10 with the last Intel drivers installed. And the binaries are the "zeranoe".
You can find it with a pure qsv HW transcoding pipeline:
ffmpeg -hwaccel qsv -v verbose -c:v h264_qsv -i input_h264.mp4 -c:v mpeg2_qsv test_qsv.mp4
On my side, I see can the log:
Initialize MFX session: API version is 1.28, implementation version is 1.29
Could you please report what the log on your side to me?
Here it is!
[AVHWDeviceContext @ 000001e7de3a76c0] Using D3D9Ex device. [AVHWDeviceContext @ 000001e7de3a7a40] Initialize MFX session: API version is 1.27, implementation version is 1.11 [AVHWDeviceContext @ 000001e7de3a7a40] MFX compile/runtime API: 1.27/1.11 [graph 0 input from stream 0:0 @ 000001e7de798c00] w:1280 h:720 pixfmt:qsv tb:1/90000 fr:60/1 sar:0/1 sws_param:flags=2 [mpeg2_qsv @ 000001e7de3a64c0] Using the average variable bitrate (AVBR) ratecontrol method [mpeg2_qsv @ 000001e7de3a64c0] Error initializing the encoder: invalid video parameters (-15) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Replying to lizhong1008:
- Could you please tell me what is your MSDK API version and library version.
- Apply the patch:
-#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11)
+#define QSV_HAVE_CO3 0
Don't change anything else.
- If it is possible, update your MSDK version can try again.
I'll do more tests. But, your suggestion of patch is already included in my previous fix! But it disables at all QVBR.
Your previous fix disale two things: both CO3 and QVBR, what is the exact one can fix this problem? CO3 or QVBR, or must disable all of the two?
My previous "solution" is a simple "workaround". When I disable the QVBR it runs. However, to disable QVBR I need to disable CO3 too... or the code doesn't compile. I'm sure CO3 isn't related to this bug.
In any case, please try it on Windows.
Sorry, I have no Windows qsv environment now.
So if it's work for you, then the problem is only on Windows. The Zeranoe binaries are the standard redistributable binaries. And *all* versions before the date of 2019-01-25 fail. So as the only change in this date is the QVBR support, then the problem is related to it. Futhermore, if I disable QVBR (with my workaround) the codec returns to work.
So, the conclusion is simple: QVBR doesn't work in Windows for the MPEG2_QSV encoder. Almost with the current code.
Regards.
follow-up: 14 comment:13 by , 6 years ago
Hi lizhong1008,
Sorry, I have no Windows qsv environment now.
Regarding this you don't need the SDK or compile environment at all!
Download the FFmpeg Zeranoe binaries from here: https://ffmpeg.zeranoe.com/builds/
Just decompress the ZIP in *ANY* Windows 10 with Intel drivers, and run it.
WORKING OK:
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20190124-3224d66-win64-static.zip
FAILS:
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20190125-260f196-win64-static.zip
Please, check it!
comment:14 by , 6 years ago
Replying to atorp:
However, to disable QVBR I need to disable CO3 too... or the code doesn't compile. I'm sure CO3 isn't related to this bug.
Why it can't compile? I applied such a patch on my side (without any other changes such as disable CO3):
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index f2f4d38503..46db07728d 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -53,13 +53,13 @@ #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF 0 #else #define QSV_HAVE_AVBR 0 #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 28) #define QSV_HAVE_VCM 0 -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 28) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25) #endif
Compile passed on my side (still on Linux).
Here it is: Initialize MFX session: API version is 1.27, implementation version is 1.11
Your MSDK API version is 1.27 but MSDK library version is 1.11 which is quite old.
Just decompress the ZIP in *ANY* Windows 10 with Intel drivers, and run it.
Tried it on one Windows platform, it works but provided a warning:
C:\Users\zhongli1>ffmpeg -hwaccel qsv -c:v h264_qsv -i X:\bbb_sunflower_1080p_30fps_normal_2000frames.h264 -c:v mpeg2_qsv X:\test.mp4 -v verbose ffmpeg version N-93022-g260f1960e7 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (GCC) 20181201 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 44.100 / 58. 44.100 libavformat 58. 26.100 / 58. 26.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 48.100 / 7. 48.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 [h264 @ 000002171f9ac8c0] Reinit context to 1920x1088, pix_fmt: yuv420p [h264 @ 000002171f99a800] max_analyze_duration 5000000 reached at 5000000 microseconds st:0 Input #0, h264, from 'X:\bbb_sunflower_1080p_30fps_normal_2000frames.h264': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1200k tbn, 60 tbc File 'X:\test.mp4' already exists. Overwrite ? [y/N] y [AVBSFContext @ 000002171fdb0f00] The input looks like it is Annex B already Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_qsv) -> mpeg2video (mpeg2_qsv)) Press [q] to stop, [?] for help [AVHWDeviceContext @ 000002172035cb40] Using D3D9Ex device. [AVHWDeviceContext @ 000002172035b8c0] Initialize MFX session: API version is 1.27, implementation version is 1.27 [AVHWDeviceContext @ 000002172035b8c0] MFX compile/runtime API: 1.27/1.27 [graph 0 input from stream 0:0 @ 000002171f9a2d40] w:1920 h:1080 pixfmt:qsv tb:1/1200000 fr:30/1 sar:1/1 sws_param:flags=2 [mpeg2_qsv @ 000002171fdb00c0] Using the average variable bitrate (AVBR) ratecontrol method [mpeg2_qsv @ 000002171fdb00c0] Warning in encoder initialization: incompatible video parameters (5) [mpeg2_qsv @ 000002171fdb00c0] profile: main; level: 4 [mpeg2_qsv @ 000002171fdb00c0] GopPicSize: 250; GopRefDist: 4; GopOptFlag: closed ; IdrInterval: 0 [mpeg2_qsv @ 000002171fdb00c0] TargetUsage: 4; RateControlMethod: CBR [mpeg2_qsv @ 000002171fdb00c0] BufferSizeInKB: 91; InitialDelayInKB: 45; TargetKbps: 1000; MaxKbps: 1000; BRCParamMultiplier: 1 [mpeg2_qsv @ 000002171fdb00c0] NumSlice: 68; NumRefFrame: 0 [mpeg2_qsv @ 000002171fdb00c0] RateDistortionOpt: unknown [mpeg2_qsv @ 000002171fdb00c0] RecoveryPointSEI: unknown IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0 [mpeg2_qsv @ 000002171fdb00c0] MaxFrameSize: 0; MaxSliceSize: 0; [mpeg2_qsv @ 000002171fdb00c0] BitrateLimit: unknown; MBBRC: unknown; ExtBRC: unknown [mpeg2_qsv @ 000002171fdb00c0] Trellis: auto [mpeg2_qsv @ 000002171fdb00c0] VDENC: OFF [mpeg2_qsv @ 000002171fdb00c0] RepeatPPS: unknown; NumMbPerSlice: 0; LookAheadDS: unknown [mpeg2_qsv @ 000002171fdb00c0] AdaptiveI: unknown; AdaptiveB: unknown; BRefType: auto [mpeg2_qsv @ 000002171fdb00c0] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0 [mpeg2_qsv @ 000002171fdb00c0] FrameRateExtD: 1; FrameRateExtN: 30 Output #0, mp4, to 'X:\test.mp4': ... C:\Users\zhongli1>ffmpeg -hwaccel qsv -c:v h264_qsv -i X:\bbb_sunflower_1080p_30fps_normal_2000frames.h264 -c:v mpeg2_qsv X:\test.mp4 -v verbose ffmpeg version N-93022-g260f1960e7 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (GCC) 20181201 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 44.100 / 58. 44.100 libavformat 58. 26.100 / 58. 26.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 48.100 / 7. 48.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 [h264 @ 000002171f9ac8c0] Reinit context to 1920x1088, pix_fmt: yuv420p [h264 @ 000002171f99a800] max_analyze_duration 5000000 reached at 5000000 microseconds st:0 Input #0, h264, from 'X:\bbb_sunflower_1080p_30fps_normal_2000frames.h264': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1200k tbn, 60 tbc File 'X:\test.mp4' already exists. Overwrite ? [y/N] y [AVBSFContext @ 000002171fdb0f00] The input looks like it is Annex B already Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_qsv) -> mpeg2video (mpeg2_qsv)) Press [q] to stop, [?] for help [AVHWDeviceContext @ 000002172035cb40] Using D3D9Ex device. [AVHWDeviceContext @ 000002172035b8c0] Initialize MFX session: API version is 1.27, implementation version is 1.27 [AVHWDeviceContext @ 000002172035b8c0] MFX compile/runtime API: 1.27/1.27 [graph 0 input from stream 0:0 @ 000002171f9a2d40] w:1920 h:1080 pixfmt:qsv tb:1/1200000 fr:30/1 sar:1/1 sws_param:flags=2 [mpeg2_qsv @ 000002171fdb00c0] Using the average variable bitrate (AVBR) ratecontrol method [mpeg2_qsv @ 000002171fdb00c0] Warning in encoder initialization: incompatible video parameters (5) [mpeg2_qsv @ 000002171fdb00c0] profile: main; level: 4 [mpeg2_qsv @ 000002171fdb00c0] GopPicSize: 250; GopRefDist: 4; GopOptFlag: closed ; IdrInterval: 0 [mpeg2_qsv @ 000002171fdb00c0] TargetUsage: 4; RateControlMethod: CBR [mpeg2_qsv @ 000002171fdb00c0] BufferSizeInKB: 91; InitialDelayInKB: 45; TargetKbps: 1000; MaxKbps: 1000; BRCParamMultiplier: 1 [mpeg2_qsv @ 000002171fdb00c0] NumSlice: 68; NumRefFrame: 0 [mpeg2_qsv @ 000002171fdb00c0] RateDistortionOpt: unknown [mpeg2_qsv @ 000002171fdb00c0] RecoveryPointSEI: unknown IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0 [mpeg2_qsv @ 000002171fdb00c0] MaxFrameSize: 0; MaxSliceSize: 0; [mpeg2_qsv @ 000002171fdb00c0] BitrateLimit: unknown; MBBRC: unknown; ExtBRC: unknown [mpeg2_qsv @ 000002171fdb00c0] Trellis: auto [mpeg2_qsv @ 000002171fdb00c0] VDENC: OFF [mpeg2_qsv @ 000002171fdb00c0] RepeatPPS: unknown; NumMbPerSlice: 0; LookAheadDS: unknown [mpeg2_qsv @ 000002171fdb00c0] AdaptiveI: unknown; AdaptiveB: unknown; BRefType: auto [mpeg2_qsv @ 000002171fdb00c0] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0 [mpeg2_qsv @ 000002171fdb00c0] FrameRateExtD: 1; FrameRateExtN: 30 Output #0, mp4, to 'X:\test.mp4':
You can see the Waring (at your side it is an error): Warning in encoder initialization: incompatible video parameters (5)
I guess it is due to AVBR mode is not support for mpeg2, so I changed the command line to be
ffmpeg -hwaccel qsv -c:v h264_qsv -i X:\bbb_sunflower_1080p_30fps_normal_2000frames.h264 -c:v mpeg2_qsv -maxrate 2M X:\test.mp4 -v verbose ... [AVHWDeviceContext @ 0000017a3f349f80] Using D3D9Ex device. [AVHWDeviceContext @ 0000017a3f349980] Initialize MFX session: API version is 1.27, implementation version is 1.27 [AVHWDeviceContext @ 0000017a3f349980] MFX compile/runtime API: 1.27/1.27 [graph 0 input from stream 0:0 @ 0000017a3ef9e540] w:1920 h:1080 pixfmt:qsv tb:1/1200000 fr:30/1 sar:1/1 sws_param:flags=2 [mpeg2_qsv @ 0000017a3f1b00c0] Using the variable bitrate (VBR) ratecontrol method [mpeg2_qsv @ 0000017a3f1b00c0] profile: main; level: 4 [mpeg2_qsv @ 0000017a3f1b00c0] GopPicSize: 250; GopRefDist: 4; GopOptFlag: closed ; IdrInterval: 0 [mpeg2_qsv @ 0000017a3f1b00c0] TargetUsage: 4; RateControlMethod: VBR [mpeg2_qsv @ 0000017a3f1b00c0] BufferSizeInKB: 250; InitialDelayInKB: 250; TargetKbps: 1000; MaxKbps: 2000; BRCParamMultiplier: 1 [mpeg2_qsv @ 0000017a3f1b00c0] NumSlice: 68; NumRefFrame: 0 [mpeg2_qsv @ 0000017a3f1b00c0] RateDistortionOpt: unknown [mpeg2_qsv @ 0000017a3f1b00c0] RecoveryPointSEI: unknown IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0 [mpeg2_qsv @ 0000017a3f1b00c0] MaxFrameSize: 0; MaxSliceSize: 0; [mpeg2_qsv @ 0000017a3f1b00c0] BitrateLimit: unknown; MBBRC: unknown; ExtBRC: unknown [mpeg2_qsv @ 0000017a3f1b00c0] Trellis: auto [mpeg2_qsv @ 0000017a3f1b00c0] VDENC: OFF [mpeg2_qsv @ 0000017a3f1b00c0] RepeatPPS: unknown; NumMbPerSlice: 0; LookAheadDS: unknown [mpeg2_qsv @ 0000017a3f1b00c0] AdaptiveI: unknown; AdaptiveB: unknown; BRefType: auto [mpeg2_qsv @ 0000017a3f1b00c0] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0 [mpeg2_qsv @ 0000017a3f1b00c0] FrameRateExtD: 1; FrameRateExtN: 30 ...
Now it is using VBR mode and no warning.
Could you please check this warning (Warning in encoder initialization: incompatible video parameters) existed or not with https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20190124-3224d66-win64-static.zip?
If existed, I believe windows version MSDK can't support AVBR mode for mpeg2.
follow-up: 17 comment:15 by , 6 years ago
Hi lizhong1008,
Thank you for your response!
I do these tests:
ffmpeg-24.exe -y -loglevel verbose -hwaccel qsv \ -c:v h264_qsv -i "Day-Flight.mpg" \ -c:v mpeg2_qsv -maxrate 2M test_qvbr-24.mp4 ffmpeg-25.exe -y -loglevel verbose -hwaccel qsv \ -c:v h264_qsv -i "Day-Flight.mpg" \ -c:v mpeg2_qsv -maxrate 2M test_qvbr-25.mp4
Where:
ffmpeg-24.exe = Zeranoe 2019-01-24 (version N-93020-g3224d6691c)
ffmpeg-25.exe = Zeranoe 2019-01-25 (version N-93022-g260f1960e7)
And the new parameter "-maxrate 2M" does nothing. 24 OK, and 25 ERROR!
Remember that the error is:
[AVHWDeviceContext @ 00000229fab99980] Using D3D9Ex device. [AVHWDeviceContext @ 00000229fab99700] Initialize MFX session: API version is 1.27, implementation version is 1.11 [AVHWDeviceContext @ 00000229fab99700] MFX compile/runtime API: 1.27/1.11 [graph 0 input from stream 0:0 @ 00000229faf87d80] w:1280 h:720 pixfmt:qsv tb:1/90000 fr:60/1 sar:0/1 sws_param:flags=2 [mpeg2_qsv @ 00000229fa9a00c0] Using the variable bitrate (VBR) ratecontrol method [mpeg2_qsv @ 00000229fa9a00c0] Error initializing the encoder: invalid video parameters (-15) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
So, the only diffence that I see is this: You use driver with implementation 1.27 and I use 1.11.
The two questions:
1) It's possible to do checks at runtime? Then is possible to execute the code without QVBR for mpeg2_qsv when runtime API is 1.11?
2) Wich version of drivers are you using? I use Windows 10 with last official driver versions from the Windows Update and the API prints 1.11. Which drivers I need to install?
I hope we can solve this problem.
Regards.
comment:16 by , 6 years ago
And the drivers are:
- Intel(R) HD Graphics
- Date: 2018-08-16
- Version: 10.18.10.5059
- HW ID: PCI\VEN_8086&DEV_0152&SUBSYS_308317AA&REV_09
Windows 10 Pro
follow-up: 18 comment:17 by , 6 years ago
Replying to atorp:
Hi lizhong1008,
Thank you for your response!
The two questions:
1) It's possible to do checks at runtime? Then is possible to execute the code without QVBR for mpeg2_qsv when runtime API is 1.11?
It is possible to check MSDK library version at runtime. But firstly I need to root cause.
It is still unclear to me what is the exact one need to be disable? CO3 or QVBR, or must disable all of the two?
Could you please apply the patch and report back?
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index f2f4d38503..46db07728d 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -53,13 +53,13 @@ #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF 0 #else #define QSV_HAVE_AVBR 0 #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 28) #define QSV_HAVE_VCM 0 -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 28) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25) #endif
I believe it won't break compile.
2) Wich version of drivers are you using? I use Windows 10 with last official driver versions from the Windows Update and the API prints 1.11. Which drivers I need to install?
I think what you need to update is MSDK, not driver. You can get the latest version via https://software.intel.com/en-us/media-sdk
comment:18 by , 6 years ago
Hi lizhong1008,
Could you please apply the patch and report back?
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index f2f4d38503..46db07728d 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -53,13 +53,13 @@ #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF 0 #else #define QSV_HAVE_AVBR 0 #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 28) #define QSV_HAVE_VCM 0 -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 28) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25) #endifI believe it won't break compile.
It compiles, but it solves NOTHING!
Identical error with the same input.
As I pointed days ago the only solution at time is to disable QVBR and CO3.
I don't know why, but this is the true.
2) Wich version of drivers are you using? I use Windows 10 with last official driver versions from the Windows Update and the API prints 1.11. Which drivers I need to install?
I think what you need to update is MSDK, not driver. You can get the latest version via https://software.intel.com/en-us/media-sdk
Why? The MSDK is to compile/develop. I'm using official latest Intel drivers. And this it's all required to execute the ffmpeg binary in a Windows 10 computer.
Futhermore, think that Zeranoe is the facto standard for Windows versions, and I can't do nothing regarding the SDK used to generate these binaries.
So, as a review:
- It's a fact that the "mpeg2_qsv" is currently broken in Windows when running in a enviroment with the runtime API 1.11 because the initialization of the encoder fails.
Then I suggest to check if it's possible to change the souce code in a sense that the initilization of the encoder is based on RUNTIME versions and not in COMPILE API versions.
And in the meantime, if you can produce a patch that restores the "mpeg2_qsv" functionality, it will be welcome. Think that the "h264_qsv" works after the QVBR change, so it isn't affected by the change. Only the "mpeg2_qsv" is it.
Regards.
comment:19 by , 6 years ago
Hi lizhong1008,
Regarding the problem, I think I have one idea to solve it:
- If you check in the Intel Media SDK for Linux (Open Source) you can review the MPEG2 ENCODER implementation. See this part of the code:
- https://github.com/Intel-Media-SDK/MediaSDK/blob/fcb7e6bf4c6b3acbc2698ecb45926be6ac8cd911/_studio/mfx_lib/encode_hw/mpeg2/src/mfx_mpeg2_encode_utils_hw.cpp#L602
- As you can note, inside the initialization of the Encoder the code tries to check the Hardware, with the function CheckHwCaps(), and after it checks the buffer capabilities, with the function CheckExtendedBuffers().
- My assumption is this: The MPEG2 encoder doesn't support the CO3 extension, even if the H264 encoder does it. Or perhaps it depends on the Intel CPU running, or the driver version. In any case, AT RUNTIME it's possible that the use of the CO3 extension will generate a failed initialization of the MFX context. This last is for sure true, because the only difference between the patch pointed is the inclusion of the CO3 in the code. And my proposed workaround needs to disable both QVBR and CO3. So the problem is the CO3 extension. And not because the API, but because the refuse to initialize the MFX context when configuring the MPEG2 encoder. So the only viable solution is to check it at runtime or not use it at all when configuring the MPEG2 encoder.
You agree?
comment:20 by , 6 years ago
Hi,
This is my updated TEMPORAL workaround:
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index a03ab69..18687be 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -267,10 +267,12 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, #endif #endif +#if QSV_HAVE_CO3 #if QSV_HAVE_GPB if (avctx->codec_id == AV_CODEC_ID_HEVC) av_log(avctx, AV_LOG_VERBOSE,"GPB: %s\n", print_threestate(co3->GPB)); #endif +#endif if (avctx->codec_id == AV_CODEC_ID_H264) { av_log(avctx, AV_LOG_VERBOSE, "Entropy coding: %s; MaxDecFrameBuffering: %"PRIu16"\n", @@ -343,7 +345,11 @@ static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q) } #endif #if QSV_HAVE_ICQ +#if QSV_HAVE_QVBR else if (avctx->global_quality > 0 && !avctx->rc_max_rate) { +#else + else if (avctx->global_quality > 0) { +#endif rc_mode = MFX_RATECONTROL_ICQ; rc_desc = "intelligent constant quality (ICQ)"; } @@ -598,9 +604,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.MaxKbps = max_bitrate_kbps / brc_param_multiplier; q->param.mfx.BRCParamMultiplier = brc_param_multiplier; #if QSV_HAVE_QVBR +#if QSV_HAVE_CO3 if (q->param.mfx.RateControlMethod == MFX_RATECONTROL_QVBR) q->extco3.QVBRQuality = av_clip(avctx->global_quality, 0, 51); #endif +#endif break; case MFX_RATECONTROL_CQP: quant = avctx->global_quality / FF_QP2LAMBDA; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index f2f4d38..6a218d4 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -35,7 +35,7 @@ #include "qsv_internal.h" #define QSV_HAVE_CO2 QSV_VERSION_ATLEAST(1, 6) -#define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_CO3 0 #define QSV_HAVE_CO_VPS QSV_VERSION_ATLEAST(1, 17) #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8) @@ -53,13 +53,13 @@ #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF 0 #else #define QSV_HAVE_AVBR 0 #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 28) #define QSV_HAVE_VCM 0 -#define QSV_HAVE_QVBR QSV_VERSION_ATLEAST(1, 28) +#define QSV_HAVE_QVBR 0 #define QSV_HAVE_MF QSV_VERSION_ATLEAST(1, 25) #endif
It restores all the functionality lost the the commit of QVBR.
In any case, I recomend to merge part of it with the git-master. The code of:
#if QSV_HAVE_ICQ +#if QSV_HAVE_QVBR else if (avctx->global_quality > 0 && !avctx->rc_max_rate) { +#else + else if (avctx->global_quality > 0) { +#endif
is mandatory as when disabling QVBR with the current code it's impossible to use the ICQ mode. Futhermore, the check about the use of the CO3 extension are also necessary.
Regards.
follow-up: 22 comment:21 by , 6 years ago
Please help to verify https://patchwork.ffmpeg.org/patch/12935/.
(Changing QSV_HAVE_QVBR and CO3 to be zero is not a correct way IMHO, they are pre-complie marco, not runtime checking )
Thanks!
comment:22 by , 6 years ago
Replying to lizhong1008:
Please help to verify https://patchwork.ffmpeg.org/patch/12935/.
(Changing QSV_HAVE_QVBR and CO3 to be zero is not a correct way IMHO, they are pre-complie marco, not runtime checking )
Thanks!
Hi lizhong1008,
Thank you! I'll check it.
However I feel your patch is unfinished. See this part of the code:
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qsvenc.c#L346
else if (avctx->global_quality > 0 && !avctx->rc_max_rate) { rc_mode = MFX_RATECONTROL_ICQ; rc_desc = "intelligent constant quality (ICQ)"; } ... #if QSV_HAVE_QVBR else if (avctx->global_quality > 0) { rc_mode = MFX_RATECONTROL_QVBR; rc_desc = "constant quality with VBR algorithm (QVBR)"; } #endif
When selecting MPEG2 encoding, and Global Quality Control and a MAX-BITRATE... which RC is selected then? As the QVBR is not functional with MPEG2 but enabled in the compilation.
follow-up: 24 comment:23 by , 6 years ago
Hi lizhong1008,
I think you need to add this change:
#if QSV_HAVE_ICQ +#if QSV_HAVE_QVBR else if (avctx->global_quality > 0 && !avctx->rc_max_rate) { +#else + else if (avctx->global_quality > 0) { +#endif rc_mode = MFX_RATECONTROL_ICQ; rc_desc = "intelligent constant quality (ICQ)"; } #endif
And regarding your patch https://patchwork.ffmpeg.org/patch/12935/ it doesn't work.
Any other solution?
comment:24 by , 6 years ago
Replying to atorp:
Hi lizhong1008,
I think you need to add this change:
#if QSV_HAVE_ICQ +#if QSV_HAVE_QVBR else if (avctx->global_quality > 0 && !avctx->rc_max_rate) { +#else + else if (avctx->global_quality > 0) { +#endif rc_mode = MFX_RATECONTROL_ICQ; rc_desc = "intelligent constant quality (ICQ)"; } #endif
ICQ mode doen't need to set a max_rate. If max_rate is set with global_quality, we should assume QVBR is user required. If some codec (such as mpeg2) dosen't support QVBR (or any other BRC mode), it will be checked at https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qsvenc.c#L392. Then an error will be returned, and user should aware that current BRC mode (QVBR) is not supported, and he should input valid BRC parameters.
IMHO, I haven't found such logic has big problem.
And regarding your patch https://patchwork.ffmpeg.org/patch/12935/ it doesn't work.
Any other solution?
It is weird. Probably I need to build FFmpeg form source code now? But I will be quite appreciated if you can provide an runtime solution(not a way of disable compile) since I have no much time to working on Windows.
comment:25 by , 3 years ago
I tried on windows and I think this problem is fixed now. Can we close this ticket?
comment:26 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.