[FFmpeg-trac] #8396(ffmpeg:new): hwdownload always use 0th device (hwaccel_device 0)

FFmpeg trac at avcodec.org
Sun Nov 24 21:54:57 EET 2019


#8396: hwdownload always use 0th device (hwaccel_device 0)
-------------------------------------+-------------------------------------
             Reporter:  darn         |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  ffmpeg       |                  Version:  4.2
             Keywords:  hwdownload   |               Blocked By:
  hwaccel_device                     |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 I have system with 3 GeForce GTX 1080 TI.
 I have "smart" libavfilter behaviour described at #5587. So i need to use
 hwdownload command.
 When i use hwdownload command in filter_complex ffmpeg always use 0 hw
 device.


 Run without hwdownload and hwaccel_device 2:
 {{{
 ffmpeg-cuda \
 -hide_banner \
 -probesize 10M \
 -analyzeduration 10M \
 -nostats \
 -hwaccel cuvid \
 -hwaccel_device 2 \
 -c:v h264_cuvid \
 -i
 "udp://hidden_ip:58631?reuse=1&pkt_size=1316&buffer_size=2621440&fifo_size=2621440"
 \
 -filter_complex " \
 [0:v]scale_npp=-1:-1:format=yuv420p:interp_algo=lanczos[v0] " \
 -c:v h264_nvenc \
 -preset:v llhq \
 -rc:v vbr_hq \
 -profile:v:0 high \
 -level:0 4.1 \
 -b:v:0 5600000 \
 -forced-idr 1 \
 -strict_gop 1 \
 -no-scenecut 1 \
 -g 125 \
 -r 25 \
 -keyint_min 125 \
 -c:a aac \
 -b:a 96k \
 -ac 2 \
 -ar 48000 \
 -map "[v0]" \
 -map 0:a:0 \
 -f mpegts "udp://233.34.2.219:60041?reuse=1"
 }}}

 ffmpeg starts with 11156 PID.

 {{{
 $ nvidia-smi | grep 11156
 |    2     11156      C   ffmpeg-cuda
 313MiB |
 }}}

 All working fine.


 Run with hwdownload and hwaccel_device 2:
 {{{
 ffmpeg-cuda \
 -hide_banner \
 -probesize 10M \
 -analyzeduration 10M \
 -nostats \
 -hwaccel cuvid \
 -hwaccel_device 2 \
 -c:v h264_cuvid \
 -i
 "udp://hidden_ip:58631?reuse=1&pkt_size=1316&buffer_size=2621440&fifo_size=2621440"
 \
 -filter_complex " \
 [0:v]scale_npp=-1:-1:format=yuv420p:interp_algo=lanczos,hwdownload,format=yuv420p[v0]
 " \
 -c:v h264_nvenc \
 -preset:v llhq \
 -rc:v vbr_hq \
 -profile:v:0 high \
 -level:0 4.1 \
 -b:v:0 5600000 \
 -forced-idr 1 \
 -strict_gop 1 \
 -no-scenecut 1 \
 -g 125 \
 -r 25 \
 -keyint_min 125 \
 -c:a aac \
 -b:a 96k \
 -ac 2 \
 -ar 48000 \
 -map "[v0]" \
 -map 0:a:0 \
 -f mpegts "udp://233.34.2.219:60041?reuse=1"
 }}}

 ffmpeg starts with 936 PID.

 {{{
 $ nvidia-smi | grep 936
 |    0       936      C   ffmpeg-cuda
 196MiB |
 |    2       936      C   ffmpeg-cuda
 259MiB |
 }}}

 All working '''not''' fine. Stream was copied to 0 device.


 Run with hwdownload and hwaccel_device 0:
 {{{
 ffmpeg-cuda \
 -hide_banner \
 -probesize 10M \
 -analyzeduration 10M \
 -nostats \
 -hwaccel cuvid \
 -hwaccel_device 0 \
 -c:v h264_cuvid \
 -i
 "udp://hidden_ip:58631?reuse=1&pkt_size=1316&buffer_size=2621440&fifo_size=2621440"
 \
 -filter_complex " \
 [0:v]scale_npp=-1:-1:format=yuv420p:interp_algo=lanczos,hwdownload,format=yuv420p[v0]
 " \
 -c:v h264_nvenc \
 -preset:v llhq \
 -rc:v vbr_hq \
 -profile:v:0 high \
 -level:0 4.1 \
 -b:v:0 5600000 \
 -forced-idr 1 \
 -strict_gop 1 \
 -no-scenecut 1 \
 -g 125 \
 -r 25 \
 -keyint_min 125 \
 -c:a aac \
 -b:a 96k \
 -ac 2 \
 -ar 48000 \
 -map "[v0]" \
 -map 0:a:0 \
 -f mpegts "udp://233.34.2.219:60041?reuse=1"
 }}}

 ffmpeg starts with 936 PID.

 {{{
 $ nvidia-smi | grep 3952
 |    0      3952      C   ffmpeg-cuda
 456MiB |
 }}}

 All working fine.

 As you can see, hwdownload always use 0th hwaccel_device.

 Is it working as expected?

 How can I make ffmpeg stop copying the stream to the 0th device?

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8396>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list