Closed YaboWei closed 6 years ago
Would you please try to verify the https://patchwork.ffmpeg.org/patch/10681/ is helpful? I am going to merge this patch.
Reproduced this issue, and 50 frames could be decoded by qsvdec with the resolution 540x960 after applying this patch.
@lizhong1008 @fulinjie This patch fixed my issue. thanks a lot.
@YaboWei your command failed on my side "./ffmpeg -hwaccel qsv -c:v h264_qsv -re -i ~/change_reso.flv -vsync passthrough -c:v h264_qsv -b:v 1000k -g 100 -c:a copy -y out.flv -loglevel verbose: Looks like in such a case, ffmpeg will insert a software filter (auto_scale) to make sure the encoded stream has a unified resolution, but the above command is working in GPU memory then the command failed. I don't know whether there is any option to disable auto_scale, but changing the above command to work on system memory is ok on my side: ./ffmpeg -c:v h264_qsv -re -i ~/change_reso.flv -vsync passthrough -c:v h264_qsv -b:v 1000k -g 100 -c:a copy -y out.flv -loglevel verbose
@lizhong1008 Yes.ffmpeg will failed when detect resolutino changed and insert a software filter. My application will handle resolution change, not ffmpeg's responsibility.
Patches merged as 63dcd3bf59378ed2a05557025d3354a5534e7e8c on intel ffmpeg plugin. And also merged to ffmpeg mainline 87368884a52b09eef96190ff1654d56591ec7038
Hi,all I have a h264 video, and the video's resolution is changed from 540x960 to 540x360. I am trying to decode this video with qsvdec, I found that qsvdec detect the resolution changed and reinit the decoder at https://github.com/Intel-FFmpeg-Plugin/Intel_FFmpeg_plugins/blob/8b371aa989e84cdf67344443cb1295fe9f54d1ca/libavcodec/qsvdec.c#L539 , but not all frame with resolution 540x960 flushed from decoder.
I use ffprobe to find out how many 540x960 frames the video has:
./ffprobe ~/change_reso.flv -show_frames -print_format compact | grep video | grep height=960 -c
it print 50.I add a print when qsvdec got_frame:
av_log(avctx, AV_LOG_INFO, "decoded frame, %dx%d, pts=%lld, mid=%p\n", frame->width, frame->height, frame->pts, ((mfxFrameSurface1*)frame->data[3])->Data.MemId);
and run ffmpeg like this:./ffmpeg -hwaccel qsv -c:v h264_qsv -re -i ~/change_reso.flv -vsync passthrough -c:v h264_qsv -b:v 1000k -g 100 -c:a copy -y out.flv -loglevel verbose
it turns out qsvdec decode 46 frames with resolution 540x960.Blow is my video: https://drive.google.com/open?id=1HXoRSpjjuAw8Ca8bPCzQXsFA9Q5thFVd
thanks