VideoHelp Forum




+ Reply to Thread
Results 1 to 2 of 2
  1. Member hydra3333's Avatar
    Join Date
    Oct 2009
    Location
    Australia
    Search Comp PM
    I am having a bit of trouble trying to speed up ffmpeg encodes and generally max out a 4-core with HT (windows says 8 cores, it's an i3820).
    Neither the video encoding nor the audio encoding seem to max out or indeed go all that quickly

    1. video ... OK, expected, GPU used for encoding so no CPU maxing ...
    I suppose the limiting factor is because it's using the GPU hardware to do the encoding .. using -c:v h264_nvenc
    Disk is an SSD.
    Code:
    ffmpeg.exe -threads 0 -nostats -threads 0 -i "D:\TEMP\SCRATCH\sample4.mpg" -threads 0 -an -threads 0 -map_metadata -1 -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -filter:v yadif=0:0:0,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.5:chroma_msize_x=3:chroma_msize_y=3:chroma_amount=0.5,setdar=dar=16/9 -r 25 -c:v h264_nvenc -preset hq -rc:v constqp -global_quality 22 -profile:v high -level 4.1 -pixel_format yuv420p  -threads 0 -y "D:\TEMP\SCRATCH\sample4-temp.MP4"
    Any suggestions on an nvidia GPU with a faster conversion component ?
    I have a 750Ti and recall reading the encoding is performed by a separate hardware bit on nvidia cards, however I am not sure if it's the same bit (and speed) across nvidia cards.
    Yes, I went to town with "-threads 0" in the commandline.
    Advice welcomed.

    2. audio
    I have discovered ffmpeg's Loudnorm audio filter and it is lovely, my TV viewing is now at the same level
    It's described here http://k.ylo.ph/2016/04/04/loudnorm.html
    The Loudnorm audio filter does appear to be single threaded (apparent when monitoring a "detection" first pass).
    Windows Resource Monitor on an 8-core shows lovely graphs with high cpu usage swapping between cpus - but only one CPU gets maxed out at any one time, the others are basically 0.
    When combined with a second conversion pass (refer below) it stays "single threaded".
    Maybe it's the nature of Loudnorm's algorithms ?
    Advice welcomed.
    Code:
    @setlocal ENABLEDELAYEDEXPANSION
    @setlocal enableextensions
    SET lI=-16
    SET lTP=0.0
    SET lLRA=11
    set jsonfile=.\loudnorm_findings.json
    REM --- find loudness parameters 
    ffmpeg.exe -threads 0 -nostats -nostdin -y -hide_banner -threads 0 -i "D:\TEMP\SCRATCH\sample4.mpg" -threads 0 -vn -threads 0 -af loudnorm=I=%lI%:TP=%lTP%:LRA=%lLRA%:print_format=json -threads 0 -f null - 2> "%jsonFile%"
    REM all the windows trickery below is simply to remove quotes and tabs and spaces from the single-level json response
    set input_i=
    set input_tp=
    set input_lra=
    set input_thresh=
    set target_offset=
    for /f "tokens=1,2 delims=:, " %%a in (' find ":" ^< "%jsonFile%" ') do (
       set "var="
       for %%c in (%%~a) do set "var=!var!,%%~c"
       set var=!var:~1!
       set "val="
       for %%d in (%%~b) do set "val=!val!,%%~d"
       set val=!val:~1!
    REM   echo .!var!.=.!val!.
       IF /I "!var!" == "input_i"         set !var!=!val!
       IF /I "!var!" == "input_tp"        set !var!=!val!
       IF /I "!var!" == "input_lra"       set !var!=!val!
       IF /I "!var!" == "input_thresh"    set !var!=!val!
       IF /I "!var!" == "target_offset"   set !var!=!val!
    )
    echo input_i=%input_i%
    echo input_tp=%input_tp%
    echo input_lra=%input_lra%
    echo input_thresh=%input_thresh%
    echo target_offset=%target_offset%
    set loudnormfilter=loudnorm=I=%lI%:TP=%lTP%:LRA=%lLRA%:measured_I=%input_i%:measured_LRA=%input_lra%:measured_TP=%input_tp%:measured_thresh=%input_thresh%:offset=%target_offset%:linear=true:print_format=summary
    echo loudnormfilter=%loudnormfilter% 
    REM --- convert to mp3 and use loudness parameters.  aac would instead be -c:a libfdk_aac and an output file with extension .aac 
    ffmpeg.exe -threads 0 -nostats -threads 0 -i "D:\TEMP\SCRATCH\sample4.mpg" -threads 0 -vn -map_metadata -1 -af %loudnormfilter% -c:a libmp3lame -ab 256k -ar 48000 -threads 0 -y "D:\TEMP\SCRATCH\sample4.mp3" 
    REM
    REM resulting in eg
    REM ffmpeg.exe -threads 0 -nostats -nostdin -y -hide_banner -threads 0 -i "D:\TEMP\SCRATCH\sample4.mpg" -threads 0 -vn -threads 0 -af loudnorm=I=-16:TP=0.0:LRA=11:print_format=json -threads 0 -f null - 2> ".\loudnorm_findings.json"
    REM set loudnormfilter=loudnorm=I=-16:TP=0.0:LRA=11:measured_I=-24.62:measured_LRA=8.00:measured_TP=-11.15:measured_thresh=-34.88:offset=1.17:linear=true:print_format=summary 
    REM ffmpeg.exe -threads 0 -nostats -threads 0 -i "D:\TEMP\SCRATCH\sample4.mpg" -threads 0 -vn -threads 0 -map_metadata -1 -af loudnorm=I=-16:TP=0.0:LRA=11:measured_I=-24.62:measured_LRA=8.00:measured_TP=-11.15:measured_thresh=-34.88:offset=1.17:linear=true:print_format=summary -c:a libmp3lame -ab 256k -ar 48000 -threads 0 -y "D:\TEMP\SCRATCH\sample4.mp3"
    Last edited by hydra3333; 13th Jan 2017 at 20:16.
    Quote Quote  
  2. Sorry - bad filter. Loudnorm vs Dynaudnorm - prefer dynaudnorm, previous comment about threading capabilities (lack of multithreading) on filters (most of them) in ffmpeg is valid.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!