[FFmpeg-user] Intel QSV Transcoding Stops on Resolution Change
Shane Warren
shanew at innovsys.com
Fri Aug 30 17:23:22 EEST 2024
I am transcoding live video using intel flex 140 cards, and the video mostly stays one resolution/framerate but sometimes ads come in that are in different resolutions, and that either crashes ffmpeg (in libmfx) or stops ffmpeg.
For example, an input stream starts out at 1280x720p at 60 then eventually changes 1920x1080i at 30 and then back to 1280x720p at 60.
I've tried using many ways to make FFmpeg survive the resolution change:
- software decoding, then vpp_qsv (for deinterlacing and scaling), then h264_qsv... this crashes inside libmfx if a resolution change happens
- hardware decoding using vaapi, then hwmap=derive_device=qsv, then vpp_qsv (for deinterlacing and scaling), then h264_qsv this just stops with this message:
[graph 0 input from stream 0:0 @ 0x561180fc1ac0] w:1920 h:1080 pixfmt:vaapi tb:1/90000 fr:60000/1001 sar:1/1
[scaler_out_0_0 @ 0x561181e57ac0] w:1280 h:720 flags:'' interl:0
[auto_scale_0 @ 0x561181430e80] w:iw h:ih flags:'' interl:0
[format @ 0x561181e6dd80] auto-inserting filter 'auto_scale_0' between the filter 'scaler_out_0_0' and the filter 'format'
Impossible to convert between the formats supported by the filter 'scaler_out_0_0' and the filter 'auto_scale_0'
- I also tried software decoding, then using vaapi deinterlacing, and vaapi scaling, this exits with the same error as above.
- I should note that I can't use qsv decoding because I noticed qsv decoding strips off a53 captions, which I need.
Any ideas on what combination of decoding, deinterlacing/scaling, and encoding I can use with these flex 140 cards that can handle a resolution change on the input.
Here is my ffmpeg command line when I'm using vaapi to decode and qsv to encode:
ffmpeg -y -threads 2 -nostats -nostdin -loglevel verbose -progress pipe:1 -probesize 5M -filter_threads 4 -threads 2 -fflags +genpts -fflags discardcorrupt -hwaccel_output_format vaapi \
-qsv_device /dev/dri/card1 -init_hw_device qsv=hw -filter_hw_device hw -hwaccel vaapi \
-i "udp://@225.105.0.28:10102??fifo_size=2146880&buffer_size=65535&timeout=800000" \
-threads 2 -c:a:0 ac3 -dialnorm -28 -threads 2 -ac:a:0 6 -ar:a:0 48000 -b:a:0 384k -flush_packets 0 \
-filter_complex "[0:v:0]fps=60000/1001,hwmap=derive_device=qsv,vpp_qsv=deinterlace=2:w=1280:h=720[vout]" \
-map "[vout]" -map "0:a:0" \
-c:v h264_qsv -b:v 3000k -minrate:v 3000k -maxrate:v 3000k -bufsize:v 6000k -preset veryfast -scenario livestreaming -strict_gop 1 -forced_idr 1 -profile:v high -level:v 4.2 -bf:v 0 -g:v 30 \
-f mpegts -muxrate 3863560 -pes_payload_size 1528 "udp://@225.105.0.35:10102?pkt_size=1316&fifo_size=90000&bitrate=3863560&burst_bits=10528&ttl=64"
More information about the ffmpeg-user
mailing list