Hi, I have a cmd like this to convert mjpeg into h264 using the qsv hw encoder on windows:
ffmpeg.exe -loglevel debug -use_wallclock_as_timestamps 1 -f mjpeg -hwaccel qsv -c:v mjpeg_qsv -i - -movflags empty_moov -frag_duration 100000 -nostats -metadata rotate=0 -vf format=qsv -c:v h264_qsv -flush_packets 1 file.mp4 This works until the size of the incoming jpeg changes and there is an error and ffmpeg exits (log follows at the end of the message). I've tried adding a scaling filter so that the dimensions of the output stay the same, eg: ffmpeg.exe -loglevel debug -use_wallclock_as_timestamps 1 -f mjpeg -hwaccel qsv -c:v mjpeg_qsv -i - -movflags empty_moov -frag_duration 100000 -nostats -metadata rotate=0 -vf vpp_qsv='width=iw+mod(iw,2):height=ih+mod(ih,2)' -c:v h264_qsv -flush_packets 1 file.mp4 But this doesn't seem to change much. I get a very similar debug log and error. Using libx264 I don't have such an issue. So is this a limitation/bug in the qsv_h264 encoder? Or am I missing something in my command? Input #0, mjpeg, from 'pipe:': Duration: N/A, start: 1629142556.362805, bitrate: N/A Stream #0:0, 1, 1/1200000: Video: mjpeg (Baseline), 1 reference frame, yuvj420p(pc, bt470bg/unknown/unknown, center), 1925x939 [SAR 1:1 DAR 1925:939], 0/1, 25 tbr, 1200k tbn$ 25 tbc Successfully opened the file. Parsing a group of options: output url /tmp/tmp4CrSJa-video/266d372a-fec9-11eb-b8b7-00155d4b0807.mp4. Applying option metadata (add metadata) with argument rotate=0. Applying option vf (set video filters) with argument format=qsv. Applying option c:v (codec name) with argument h264_qsv. Successfully parsed a group of options. Opening an output file: /tmp/tmp4CrSJa-video/266d372a-fec9-11eb-b8b7-00155d4b0807.mp4. [file @ 0000025f7a384680] Setting default whitelist 'file,crypto,data' Successfully opened the file. Stream mapping: Stream #0:0 -> #0:0 (mjpeg (mjpeg_qsv) -> h264 (h264_qsv)) cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) [AVHWDeviceContext @ 0000025f7a386300] Using D3D9Ex device. [AVHWDeviceContext @ 0000025f7a386200] Initialize MFX session: API version is 1.34, implementation version is 1.32 [mjpeg_qsv @ 0000025f7a3810c0] Format qsv chosen by get_format(). [mjpeg_qsv @ 0000025f7a3810c0] Decoder: output is video memory surface [mjpeg_qsv @ 0000025f7a3810c0] Format qsv chosen by get_format(). [mjpeg_qsv @ 0000025f7a3810c0] Decoder: output is video memory surface cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) Last message repeated 2 times Frame parameters mismatch context 1926,940,116 != 1926,940,23 detected 8 logical cores [Parsed_format_0 @ 0000025f7a3f9b00] Setting 'pix_fmts' to value 'qsv' [graph 0 input from stream 0:0 @ 0000025f7a3f9c80] Setting 'video_size' to value '1926x940' [graph 0 input from stream 0:0 @ 0000025f7a3f9c80] Setting 'pix_fmt' to value '116' [graph 0 input from stream 0:0 @ 0000025f7a3f9c80] Setting 'time_base' to value '1/1200000' [graph 0 input from stream 0:0 @ 0000025f7a3f9c80] Setting 'pixel_aspect' to value '1/1' [graph 0 input from stream 0:0 @ 0000025f7a3f9c80] Setting 'frame_rate' to value '25/1' [graph 0 input from stream 0:0 @ 0000025f7a3f9c80] w:1926 h:940 pixfmt:qsv tb:1/1200000 fr:25/1 sar:1/1 [format @ 0000025f7a3dad80] Setting 'pix_fmts' to value 'nv12|p010le|qsv' [AVFilterGraph @ 0000025f7a3e9180] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed [h264_qsv @ 0000025f7a383340] Using input frames context (format qsv) with h264_qsv encoder. [h264_qsv @ 0000025f7a383340] Encoder: input is video memory surface [h264_qsv @ 0000025f7a383340] Using the average variable bitrate (AVBR) ratecontrol method [h264_qsv @ 0000025f7a383340] profile: high; level: 40 [h264_qsv @ 0000025f7a383340] GopPicSize: 250; GopRefDist: 4; GopOptFlag: closed ; IdrInterval: 0 [h264_qsv @ 0000025f7a383340] TargetUsage: 4; RateControlMethod: AVBR [h264_qsv @ 0000025f7a383340] TargetKbps: 1000; Accuracy: 1; Convergence: 1; BRCParamMultiplier: 1 [h264_qsv @ 0000025f7a383340] NumSlice: 1; NumRefFrame: 3 [h264_qsv @ 0000025f7a383340] RateDistortionOpt: OFF [h264_qsv @ 0000025f7a383340] RecoveryPointSEI: OFF IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0 [h264_qsv @ 0000025f7a383340] MaxFrameSize: 702720; MaxSliceSize: 0; [h264_qsv @ 0000025f7a383340] BitrateLimit: ON; MBBRC: OFF; ExtBRC: OFF [h264_qsv @ 0000025f7a383340] Trellis: auto [h264_qsv @ 0000025f7a383340] VDENC: OFF [h264_qsv @ 0000025f7a383340] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS: 2x [h264_qsv @ 0000025f7a383340] AdaptiveI: OFF; AdaptiveB: OFF; BRefType: pyramid [h264_qsv @ 0000025f7a383340] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0 [h264_qsv @ 0000025f7a383340] Entropy coding: CABAC; MaxDecFrameBuffering: 3 [h264_qsv @ 0000025f7a383340] NalHrdConformance: OFF; SingleSeiNalUnit: ON; VuiVclHrdParameters: OFF VuiNalHrdParameters: OFF [h264_qsv @ 0000025f7a383340] FrameRateExtD: 1; FrameRateExtN: 25 [mp4 @ 0000025f7a3816c0] Empty MOOV enabled; disabling automatic bitstream filtering Output #0, mp4, to '/tmp/tmp4CrSJa-video/266d372a-fec9-11eb-b8b7-00155d4b0807.mp4': Metadata: rotate : 0 encoder : Lavf58.76.100 Stream #0:0, 0, 1/12800: Video: h264, 1 reference frame (avc1 / 0x31637661), qsv(pc, bt470bg/unknown/unknown, progressive, center), 1926x940 (0x0) [SAR 1:1 DAR 963:470], 0/1, q=2-31, 1000 kb/s, 25 fps, 12800 tbn Metadata: encoder : Lavc58.134.100 h264_qsv Side data: cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A Clipping frame in rate conversion by 0.000008 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) Frame parameters mismatch context 1926,940,116 != 1926,940,23 Clipping frame in rate conversion by 0.033638 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) Frame parameters mismatch context 1926,940,116 != 1926,940,23 *** 7 dup! ... [mjpeg_qsv @ 0000025f7a3810c0] Format qsv chosen by get_format(). [mjpeg_qsv @ 0000025f7a3810c0] Decoder: output is video memory surface Frame parameters mismatch context 1926,940,116 != 1538,750,23 *** 3 dup! [mjpeg_qsv @ 0000025f7a3810c0] Format qsv chosen by get_format(). [mjpeg_qsv @ 0000025f7a3810c0] Decoder: output is video memory surface Frame parameters mismatch context 1926,940,116 != 1152,748,23 *** 6 dup! Frame parameters mismatch context 1926,940,116 != 1152,748,23 *** 3 dup! Frame parameters mismatch context 1538,750,116 != 1152,748,23 [Parsed_format_0 @ 0000025f7a38de00] Setting 'pix_fmts' to value 'qsv' [graph 0 input from stream 0:0 @ 0000025f7a38d900] Setting 'video_size' to value '1538x750' [graph 0 input from stream 0:0 @ 0000025f7a38d900] Setting 'pix_fmt' to value '116' [graph 0 input from stream 0:0 @ 0000025f7a38d900] Setting 'time_base' to value '1/1200000' [graph 0 input from stream 0:0 @ 0000025f7a38d900] Setting 'pixel_aspect' to value '1/1' [graph 0 input from stream 0:0 @ 0000025f7a38d900] Setting 'frame_rate' to value '25/1' [graph 0 input from stream 0:0 @ 0000025f7a38d900] w:1538 h:750 pixfmt:qsv tb:1/1200000 fr:25/1 sar:1/1 [scaler_out_0_0 @ 0000025f7a38df00] Setting 'w' to value '1926' [scaler_out_0_0 @ 0000025f7a38df00] Setting 'h' to value '940' [scaler_out_0_0 @ 0000025f7a38df00] Setting 'flags' to value 'bicubic' [scaler_out_0_0 @ 0000025f7a38df00] w:1926 h:940 flags:'bicubic' interl:0 [format @ 0000025f7a38c900] Setting 'pix_fmts' to value 'qsv' [auto_scaler_0 @ 0000025f7a38d500] Setting 'flags' to value 'bicubic' [auto_scaler_0 @ 0000025f7a38d500] w:iw h:ih flags:'bicubic' interl:0 [scaler_out_0_0 @ 0000025f7a38df00] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_format_0' and the filter 'scaler_out_0_0' Impossible to convert between the formats supported by the filter 'Parsed_format_0' and the filter 'auto_scaler_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 [AVIOContext @ 0000025f7a3850c0] Statistics: 0 seeks, 161 writeouts [AVIOContext @ 0000025f7a37ff00] Statistics: 1041917 bytes read, 0 seeks Conversion failed! _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".