[FFmpeg-user] ffmpeg transcoding multicast to multicast stuck in disk sleep

DopeLabs dopelabs at dubstep.fm
Sun May 27 02:44:29 EEST 2018

after a quick look here: https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDACUVIDNVDEC

in your provided command, the cuvid decoder is passing the frames through system memory.

you can achieve full hardware transcode with CUVID and NVENC:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input -c:v h264_nvenc -preset ultrafast output.mkv

i also could not find the -gpu option anywhere in the ffmpeg documentation, but i did find 

-hwaccel_device 0

i havent had any experience using cuvid or nvenc but this is just what i found after a quick look.. maybe it can help =]


> On May 25, 2018, at 12:20 30PM, Jakub Vojáček <jakub at jacon.cz> wrote:
> Hello,
> we are receiving multicast and using nvidia, we are transcoding it into 2
> bitrates and sending to another multicast. When we are having just one
> ffmpeg like this, it is working fine. But as we add more channels to
> transcode, the ffmpeg is suddenly having problems. It slows down the
> transcoding speed from 1x to less, usually 0.6-0.999. But as it is
> live content, we cannot have it slower than 1x. The server has plenty of
> available resources (RAM, CPU, GPU) when this problem starts to happen.
> By looking deeper into the problem, we found that the ffmpeg process is in
> the D state (disk sleep) using cat /proc/PID/status. But according to iotop
> the hdd, has still available resources. And why is ffmpeg even using
> hdd when transcoding from multicast to multicast (network to network)?
> There should be no HDD involved, or am I mistaken?
> Sample ffmpeg command:
> ffmpeg -y  -gpu 1 -c:v h264_cuvid  -deint adaptive -drop_second_field 1
> -resize 1920x1080 -i 'udp://@
> 12000000&pkt_size=1316
> <>'
> -filter_complex "[0:0]drawtext=text='':font=DejaVuSans:fontsize=40:
> fontcolor=#dddddd:x=(w/2)-(text_w/2):y=h*(0.05):box=1:
> boxborderw=10:boxcolor=#dd0000[main],[main]split=2[v1][v2],[v1]scale=512:288[v1]"
> \
> -map "[v1]" -flush_packets 0 -gpu 1 -r:v:0 25 -aspect:v:0 16:9 -g:v:0 80
> -vcodec:v:0 h264_nvenc -b:v:0 400K -minrate:v:0 1000k -maxrate:v:0 1000k
> -bufsize:v:0 500k \
> -map "[v2]" -flush_packets 0 -gpu 1 -r:v:1 25 -aspect:v:1 16:9 -g:v:1 80
> -vcodec:v:1 h264_nvenc -b:v:1 4500K -minrate:v:1 4500k -maxrate:v:1 4500k
> -bufsize:v:1 2250k \
> -map i:0xb08 -flush_packets 0 -ab:a:0 128k -ar:a:0 48k -acodec:a:0
> libfdk_aac -ac:a:0 2 -flags:a:0 +global_header \
> -f mpegts "udp://@"
> ffmpeg configuration (we tried with latest version as well):
> ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers
>  built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
>  configuration: --prefix=/usr/local --enable-nonfree --enable-gpl
> --enable-version3 --enable-shared --enable-pic --enable-avresample
> --enable-fontconfig --enable-frei0r --enable-ladspa --enable-libass
> --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac
> --enable-libflite --enable-libfreetype --enable-libfribidi
> --enable-libmodplug --enable-libmp3lame --enable-libopus --enable-librtmp
> --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtwolame
> --enable-libv4l2 --enable-libwavpack --enable-libwebp --enable-libx264
> --enable-libx265 --enable-libzvbi --enable-decklink --enable-nvenc
> --enable-openssl
> Thank you for your ideas and advice.
> Jakub
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://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