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

on windows 10 compile mfx_dispatch with MSDK 2021 R1 and FFMPEG for QSV function failed, do you have any guide for this? #87

Open
zhaoye1 opened this issue Aug 20, 2021 · 4 comments

Comments

@zhaoye1
Copy link

zhaoye1 commented Aug 20, 2021

when I running ./ffmpeg.exe -i in.mp4 -vcodec h264_qsv out.h264
it report error:
[h264_qsv @ 000002305B5F00C0] Error querying encoder params: unsupported (-3)
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
Conversion failed!

and when compile the FFMPEG with :mfx.lib is not found.
../configure --disable-stripping --disable-static --enable-shared --enable-debug=3 --disable-optimizations --enable-libmfx --enable-encoder=h264_qsv --enable-decoder=h264_qsv --toolchain=msvc --enable-cross-compile --extra-cflags='-I/C:/msys64/mingw64/include' --extra-ldflags='-libpath:/C:/msys64/mingw64/lib -DEFAULTLIB:legacy_stdio_definitions.lib' --prefix=../build
it log report:
check_pkg_config libmfx libmfx mfx/mfxvideo.h MFXInit
test_pkg_config libmfx libmfx mfx/mfxvideo.h MFXInit
pkg-config --exists --print-errors libmfx
check_func_headers mfx/mfxvideo.h MFXInit -IC:/msys64/mingw64/include -LC:/msys64/mingw64/lib -lmfx -lstdc++ -lole32 -luuid
test_ld cc -IC:/msys64/mingw64/include -LC:/msys64/mingw64/lib -lmfx -lstdc++ -lole32 -luuid
test_cc -IC:/msys64/mingw64/include -libpath:C:/msys64/mingw64/lib
BEGIN ./ffconf.ALlfLpqR/test.c
1 #include <mfx/mfxvideo.h>
2 #include <stdint.h>
3 long check_MFXInit(void) { return (long) MFXInit; }
4 int main(void) { int ret = 0;
5 ret |= ((intptr_t)check_MFXInit) & 0xFFFF;
6 return ret; }
END ./ffconf.ALlfLpqR/test.c
cl.exe -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -DPIC -nologo -I/C:/msys64/mingw64/include -IC:/msys64/mingw64/include -libpath:C:/msys64/mingw64/lib -c -Fo./ffconf.ALlfLpqR/test.o ./ffconf.ALlfLpqR/test.c
cl : Command line warning D9002 : ignoring unknown option '-libpath:C:/msys64/mingw64/lib'
test.c
./ffconf.ALlfLpqR/test.c(3): warning C4311: 'type cast': pointer truncation from 'mfxStatus (__cdecl *)(mfxIMPL,mfxVersion *,mfxSession *)' to 'long'
/home/iotg/package/FFmpeg/compat/windows/mslink -libpath:/C:/msys64/mingw64/lib -DEFAULTLIB:legacy_stdio_definitions.lib -nologo -IC:/msys64/mingw64/include -libpath:C:/msys64/mingw64/lib -out:./ffconf.ALlfLpqR/test.exe ./ffconf.ALlfLpqR/test.o mfx.lib ole32.lib uuid.lib
LINK : warning LNK4044: unrecognized option '/IC:/msys64/mingw64/include'; ignored
LINK : fatal error LNK1181: cannot open input file 'mfx.lib'
require libmfx mfx/mfxvideo.h MFXInit -llibmfx -ladvapi32
check_lib libmfx mfx/mfxvideo.h MFXInit -llibmfx -ladvapi32
check_func_headers mfx/mfxvideo.h MFXInit -llibmfx -ladvapi32
test_ld cc -llibmfx -ladvapi32
test_cc
BEGIN ./ffconf.ALlfLpqR/test.c
1 #include <mfx/mfxvideo.h>
2 #include <stdint.h>
3 long check_MFXInit(void) { return (long) MFXInit; }
4 int main(void) { int ret = 0;
5 ret |= ((intptr_t)check_MFXInit) & 0xFFFF;
6 return ret; }
END ./ffconf.ALlfLpqR/test.c

on windows, mfx_dispatcher compile result is libmfx.a and libmfx.la, which can not be use in FFmpeg. it just require libmfx.lib

@zhaoye1 zhaoye1 changed the title I compile mfx_dispatch with MSDK 2021 R1 and FFMPEG for QSV function failed, do you have any guide for this? on windows 10 compile mfx_dispatch with MSDK 2021 R1 and FFMPEG for QSV function failed, do you have any guide for this? Aug 20, 2021
@maximd33
Copy link
Collaborator

you might want to specify bitrate for ffmpeg, like -b:v 5M
see https://trac.ffmpeg.org/wiki/Hardware/QuickSync

compilation : recommendations to use cross compilation, not MSVC compiler directly,
otherwise you would need to experiment with it

@zhaoye1
Copy link
Author

zhaoye1 commented Aug 20, 2021

it will report the same error:
./ffmpeg.exe -i out.h264 -vcodec h264_qsv -b:v 5M out1.h264
ffmpeg version N-102969-g7ec7e6aa2d Copyright (c) 2000-2021 the FFmpeg developers
built with Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29336 for x64
configuration: --disable-stripping --enable-debug=3 --disable-optimizations --enable-debug --enable-libmfx --toolchain=msvc --enable-cross-compile --extra-cflags='-I/C:/msys64/mingw64/include -Z7' --extra-ldflags='-libpath:/C:/msys64/mingw64/lib -DEFAULTLIB:legacy_stdio_definitions.lib' --prefix=../Build
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 3.101 / 59. 3.101
libavformat 59. 4.100 / 59. 4.100
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.103 / 8. 0.103
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
Input #0, h264, from 'out.h264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1200k tbn
File 'out1.h264' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
Press [q] to stop, [?] for help
[h264_qsv @ 00000282ABEEC040] Error querying encoder params: unsupported (-3)
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
Conversion failed!

@zhaoye1
Copy link
Author

zhaoye1 commented Aug 20, 2021

do you have cross compilation guide for FFMPEG and QSV on windows ?

@maximd33
Copy link
Collaborator

@zhaoye1
FFMPEG: you can follow any cross compilation guide, like from https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows

QSV requires --enable-libmfx option and mfx_dispatch pre-installed,
already described at https://github.com/lu-zero/mfx_dispatch#building-using-autotools

it should be better to create issue at FFMPEG support page
if any problems

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

No branches or pull requests

2 participants