Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th January 2020, 12:00   #1  |  Link
peter71
Guest
 
Posts: n/a
Why avisynth bottlenecks ffmpeg nvenc-oding ?

Hi,

Transcoding of a H.264 file with my RTX2060 goes with a blazingly fast ~400 fps, when decoding is hw. accelerated too.

The same thing when served with AviSynth FFmpegSource2 (AviSynth+ 3.4 (r2923, 3.4, x86_64)) falls down to ~130fps.

Now I understand, that frameserving+decoding is a CPU intense job, and my CPU is kind of a relic (Xeon E5450), but Avsmeter says:

FPS (min | max | average): 121.2 | 251.4 | 196.3
Process memory usage (max): 47 MiB
Thread count: 9
CPU usage (average): 87.9%

This significant difference between 130 and 196 is the problem, I am trying to track down. Any idea please?
  Reply With Quote
Old 6th January 2020, 12:05   #2  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,803
Ffmpegsource uses CPU while decoding hence slower processing. L-smash on other hand supports hw decoding.
Atak_Snajpera is offline   Reply With Quote
Old 7th January 2020, 03:13   #3  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 7,890
the up and download of the video from the GPU Vram cost performance.
huhn is offline   Reply With Quote
Old 7th January 2020, 15:55   #4  |  Link
peter71
Guest
 
Posts: n/a
Quote:
Originally Posted by Atak_Snajpera View Post
Ffmpegsource uses CPU while decoding hence slower processing. L-smash on other hand supports hw decoding.
Thanks for the hint. Ffmpeg nvenc encoding reaches 111 fps with LSMASHVideoSource decoding on CPU, and 96 fps with GPU (decoder = "h264_cuvid") decoding. My motherboard's PCIE x16 slot is obviously too old for this high amount of transferred data.
  Reply With Quote
Old 7th January 2020, 16:48   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,340
Quote:
Originally Posted by peter71 View Post
Thanks for the hint. Ffmpeg nvenc encoding reaches 111 fps with LSMASHVideoSource decoding on CPU, and 96 fps with GPU (decoder = "h264_cuvid") decoding. My motherboard's PCIE x16 slot is obviously too old for this high amount of transferred data.
That might be some other problem , maybe incompatible video (some video profiles not decoded or supported by cuvid), or wrong lsmash version.
Try these
https://github.com/HolyWu/L-SMASH-Works/releases

Are you sure GPU is working for decoding? Look at GPU-z with the avs h264_cuvid script (or start up GPU-z, then use avsmeter script.avs -gpu)
poisondeathray is offline   Reply With Quote
Old 7th January 2020, 20:53   #6  |  Link
peter71
Guest
 
Posts: n/a
Quote:
Originally Posted by poisondeathray View Post
That might be some other problem , maybe incompatible video (some video profiles not decoded or supported by cuvid), or wrong lsmash version.
Try these
https://github.com/HolyWu/L-SMASH-Works/releases

Are you sure GPU is working for decoding? Look at GPU-z with the avs h264_cuvid script (or start up GPU-z, then use avsmeter script.avs -gpu)
I guess the GPU must be decoding, because GPU usage is sustained at 20% during the process. If lsmash is called with sw. decoding, it is only about 10%. I tried out the 20191127 build from your link, it performed at 99 fps.

The command and output is:

$ /cygdrive/C/util/dv/ffmpeg-20200101-7b58702-win64-static/bin/ffmpeg.exe -vsync 0 -hwaccel cuvid -i lsmash.avs -b:v 5M -c:v h264_nvenc -c:a libmp3lame -b:a 128k gpu_5M_avisynth_lsmash_cuvid.mp4
ffmpeg version git-2020-01-01-7b58702 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20191125
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 38.100 / 56. 38.100
libavcodec 58. 65.100 / 58. 65.100
libavformat 58. 35.101 / 58. 35.101
libavdevice 58. 9.102 / 58. 9.102
libavfilter 7. 70.101 / 7. 70.101
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avisynth, from 'lsmash.avs':
Duration: 00:00:49.32, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 30.03 fps, 30.03 tbr, 30.03 tbn, 30.03 tbc
Stream #0:1: Audio: pcm_f32le, 48000 Hz, stereo, flt, 3072 kb/s
File 'gpu_5M_avisynth_lsmash_cuvid.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_nvenc))
Stream #0:1 -> #0:1 (pcm_f32le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp4, to 'gpu_5M_avisynth_lsmash_cuvid.mp4':
Metadata:
encoder : Lavf58.35.101
Stream #0:0: Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, q=-1--1, 5000 kb/s, 30.03 fps, 10930 tbn, 30.03 tbc
Metadata:
encoder : Lavc58.65.100 h264_nvenc
Side data:
cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 10000000 vbv_delay: N/A
Stream #0:1: Audio: mp3 (libmp3lame) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.65.100 libmp3lame
frame= 1481 fps= 99 q=29.0 Lsize= 31618kB time=00:00:49.28 bitrate=5255.1kbits/s speed= 3.3x
video:30816kB audio:770kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.101611%



The avs script is:

LoadPlugin("c:\util\dv\LSMASH_20191127\LSMASHSource.dll")

v = LSMASHVideoSource("VID_20190119_145158.mp4", decoder = "h264_cuvid" )
a = LSMASHAudioSource("VID_20190119_145158.mp4")

audiodub(a,v)
  Reply With Quote
Reply

Tags
avisynth, bottleneck, ffmpeg, nvenc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:35.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.