[FFmpeg-user] Intel QSV Transcoding Stops on Resolution Change
Shane Warren
shanew at innovsys.com
Wed Sep 4 17:36:22 EEST 2024
-----Original Message-----
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> On Behalf Of Wang, Fei W
Sent: Wednesday, September 4, 2024 3:11 AM
To: ffmpeg-user at ffmpeg.org
Subject: Re: [FFmpeg-user] Intel QSV Transcoding Stops on Resolution Change
> -----Original Message-----
> From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> On Behalf Of Shane
> Warren
> Sent: Friday, August 30, 2024 10:23 PM
> To: ffmpeg-user at ffmpeg.org
> Subject: [FFmpeg-user] Intel QSV Transcoding Stops on Resolution
> Change
>
> 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:
You may need to add "-noautoscale" option in your cmdline. While current ffmpeg-qsv have a surface alignment issue when derive from vaapi surface in some particular resolution. If your cmd still fail, you can try this patch:
https://github.com/intel-media-ci/ffmpeg/pull/765
Thanks
Fei
--------
Fei,
The -noautoscale seems to have fixed the stop/crash on resolution changing. I can now hw decode using vaapi, then deinterlace/scale, then qsv encode. I have a capture on an input stream that does all kinds of horrible things (switches resolution and goes interlaced), I have looped that many times and the output is stable.
The autoscale/noautoscale option should be in the ffmpeg html documents online somewhere, that option is very useful for anyone transcoding live streams that change resolutions.
>
> 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&timeo
> ut=
> 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=1
> 280: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=3863
> 560
> &burst_bits=10528&ttl=64"
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmp/
> eg.org%2Fmailman%2Flistinfo%2Fffmpeg-user&data=05%7C02%7Cshanew%40inno
> vsys.com%7C3d42f0115a554a4a88f708dcccb9394d%7C7a48ce45ee974a95ac183390
> 878a179b%7C0%7C0%7C638610343143655504%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi
> MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7
> C&sdata=j6VSwfurgBUyfap%2BlVtuzmT8Oo4PWxHShb3lziesHNY%3D&reserved=0
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list