VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 54
Thread
  1. Hi cats

    I try to understand if there is a way to do an h264 hardware encoding with my notebook HP i7 J113EL

    that have a Intel HD4600 + NVidia GT750M graphic cards

    If I don't mistake using ffmpeg with -vcodec h264_nvenc is used the GT750M

    but maybe it's usable also the quicksync function? or other hardware encoding method?

    and if I use the NVidia encoding can I set to use -crf XY to do a Costant Rate Factor encoding?

    thanks
    Quote Quote  
  2. It' s in the help
    ffmpeg -h full 1>ffmpeg_fullhelp.txt
    quicksync
    -c:v h264_qsv

    nvenc doesn't have eqivalent "crf", but has cqp mode. For nvenc rate control options
    Code:
      -rc                <int>        E..V.... Override the preset rate-control (from -1 to INT_MAX) (default -1)
         constqp                      E..V.... Constant QP mode
         vbr                          E..V.... Variable bitrate mode
         cbr                          E..V.... Constant bitrate mode
         vbr_minqp                    E..V.... Variable bitrate mode with MinQP (deprecated)
         ll_2pass_quality              E..V.... Multi-pass optimized for image quality (deprecated)
         ll_2pass_size                E..V.... Multi-pass optimized for constant frame size (deprecated)
         vbr_2pass                    E..V.... Multi-pass variable bitrate mode (deprecated)
         cbr_ld_hq                    E..V.... Constant bitrate low delay high quality mode
         cbr_hq                       E..V.... Constant bitrate high quality mode
         vbr_hq                       E..V.... Variable bitrate high quality mode
    Quote Quote  
  3. mmm

    I have try

    Code:
    ffmpeg.exe -threads 12 -y -i c0113.mxf -vf scale=interl=1 -c:v h264_qsv -profile:v high -g 33 -bf 2 -an -aspect 16:9 out.mp4
    but strangely ffmpeg freeze and don't continue

    C0113.mxf is a 4:2:2 video clip
    Quote Quote  
  4. Try convert it to 420 , qsv doesn't support 422 encoding . If that doesn't work, try update driver
    Quote Quote  
  5. and alternalitevly using the nvenc what parameter is more close to the CRF 22?
    "-rc constqp" but in what way the quality value?
    Quote Quote  
  6. "crf 22" is from a different encoder , different quality, different method of rate control. There won't be anything completely comparable

    You have try some values and check if you like it
    Quote Quote  
  7. ok but it there a practical example of use of - for example - the -rc constqp?
    Quote Quote  
  8. Originally Posted by marcorocchini View Post
    ok but it there a practical example of use of - for example - the -rc constqp?
    fast encoding where output is pure VBR.
    Quote Quote  
  9. I could not get it to work until I found this thread
    Code:
    -c:v h264_nvenc -rc:v constqp -global_quality 20
    Option "-q" etc does not work, defaults to very low quality.
    Quote Quote  
  10. exactlly I don't why but yesteday the -c:v h264_nvenc works, and today I get this error

    Image
    [Attachment 42287 - Click to enlarge]


    using:

    Code:
    ffmpeg.exe -y -i c0113.mxf -vf scale=interl=1 -c:v h264_nvenc out.mp4
    Quote Quote  
  11. Copy&paste the complete ffmpeg log. Is the source not 4:2:0 while ffmpeg's Nvidia encoder only supports 4:2:0 or something like that?
    Quote Quote  
  12. You have a notebook, don't you - and doesn't the nVidia notebook GPU shut down (reverting to CPU graphics) sometimes to save power? If so, you might want to force the GPU to stay active when connected to AC power, using power profiles.
    Quote Quote  
  13. Originally Posted by sneaker View Post
    Copy&paste the complete ffmpeg log. Is the source not 4:2:0 while ffmpeg's Nvidia encoder only supports 4:2:0 or something like that?
    ffmpeg version N-81646-gc19da0c Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 5.4.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
    libavutil 55. 29.100 / 55. 29.100
    libavcodec 57. 55.101 / 57. 55.101
    libavformat 57. 48.103 / 57. 48.103
    libavdevice 57. 0.102 / 57. 0.102
    libavfilter 6. 62.100 / 6. 62.100
    libswscale 4. 1.100 / 4. 1.100
    libswresample 2. 1.100 / 2. 1.100
    libpostproc 54. 0.100 / 54. 0.100
    Guessed Channel Layout for Input Stream #0.1 : mono
    Guessed Channel Layout for Input Stream #0.2 : mono
    Guessed Channel Layout for Input Stream #0.3 : mono
    Guessed Channel Layout for Input Stream #0.4 : mono
    Guessed Channel Layout for Input Stream #0.5 : mono
    Guessed Channel Layout for Input Stream #0.6 : mono
    Guessed Channel Layout for Input Stream #0.7 : mono
    Guessed Channel Layout for Input Stream #0.8 : mono
    Input #0, mxf, from 'c0113.mxf':
    Metadata:
    uid : d9611000-5277-05c1-0270-08004602023b
    generation_uid : d9611000-5277-05c2-0270-08004602023b
    company_name : SONY
    product_name : Opt
    product_version : 1.22
    product_uid : 060e2b34-0401-0103-0e06-012002010300
    modification_date: 2016-12-30T11:55:30.000000Z
    material_package_umid: 0x060A2B340101010501010D4313000000549A160016780580 08004602023B0270
    timecode : 00:29:35:14
    Duration: 00:00:12.72, start: 0.000000, bitrate: 60347 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:3: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:4: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:5: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:6: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:7: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:8: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    [h264_nvenc @ 0000000002368b80] No NVENC capable devices found
    Output #0, mp4, to 'out.mp4':
    Metadata:
    uid : d9611000-5277-05c1-0270-08004602023b
    generation_uid : d9611000-5277-05c2-0270-08004602023b
    company_name : SONY
    product_name : Opt
    product_version : 1.22
    product_uid : 060e2b34-0401-0103-0e06-012002010300
    modification_date: 2016-12-30T11:55:30.000000Z
    material_package_umid: 0x060A2B340101010501010D4313000000549A160016780580 08004602023B0270
    timecode : 00:29:35:14
    Stream #0:0: Unknown: none, SAR 1:1 DAR 0:0
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    encoder : Lavc57.55.101 h264_nvenc
    Stream #0:1: Unknown: none
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    encoder : Lavc57.55.101 aac
    Stream mapping:
    Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_nvenc))
    Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native))
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    Quote Quote  
  14. Originally Posted by raffriff42 View Post
    You have a notebook, don't you - and doesn't the nVidia notebook GPU shut down (reverting to CPU graphics) sometimes to save power? If so, you might want to force the GPU to stay active when connected to AC power, using power profiles.

    I dont' know but not sure is a problem of the power profile however I keep alwais the maximum power in the pc using

    powercfg.exe /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
    Quote Quote  
  15. Originally Posted by sneaker View Post

    Is the source not 4:2:0 while ffmpeg's Nvidia encoder only supports 4:2:0 or something like that?

    oh I think you are right cat
    Quote Quote  
  16. Please consider this 422 source:

    https://www.dropbox.com/s/829iziwuetpdqm4/source422.MXF?dl=0

    I have try to encode with libx264 using:

    Code:
    ffmpeg64bitmar2017.exe -threads 12 -y -i source422.MXF -pix_fmt yuv420p -vf scale=interl=1,format=pix_fmts=yuv420p -c:v libx264 -profile:v high -level:v 4.1 -g 33 -bf 2 -crf 21.6 -flags +ildct+ilme -top 1 -aspect 16:9 -an x264_420.MP4
    and with NVENC using:

    Code:
    v:\automazioneclip\core\ffmpeg64bitmar2017.exe -threads 12 -y -i source422.mxf -pix_fmt yuv420p -vf scale=interl=1,format=pix_fmts=yuv420p -c:v h264_nvenc -rc:v constqp -global_quality 26 -level:v 4.1 -flags +ildct+ilme -top 1 -aspect 16:9 -an outNVENC.MP4
    Here I have attach x264_420.MP4 and outNVENC.MP4

    the x264 have more quality : the nvenc have a little "croma ghost" or an out of color in details... it's not the same quality of the x264.

    Is there a way to have or to seems the "same" quality?
    Image Attached Files
    Quote Quote  
  17. The chroma notching errors look like not sending NV12 (NVEnc expects "NV12" , not yuv420p ) .

    It is encoded with I-frame only . Try a slower preset -preset slow , which is an internal 2pass HQ mode for NVEnc, and includes bframes (unless constqp overrrides it, not sure)
    Quote Quote  
  18. [h264_nvenc @ 0000000001cf7360] Using global_quality with nvenc is deprecated. Use qp instead.

    -qp or -global_quality seem to override control and place I-frame only . Adding -bf 2 or some number doesn't overrride.

    So I recommend using VBR RC instead with -preset slow, that's NVEnc's best mode . You're not going to get something analogous to "CRF"
    Quote Quote  
  19. mmmm

    Code:
    v:\automazioneclip\core\ffmpeg64bitmar2017.exe -threads 12 -y -i source422.mxf -pix_fmt yuv420p -vf scale=interl=1,format=pix_fmts=yuv420p -c:v h264_nvenc -rc vbr_2pass -cq 30 -qmin 28 -qmax 30 -preset slow -bf 0 -global_quality 26 -level:v 4.1 -flags +ildct+ilme -top 1 -aspect 16:9 -an outNVENC.MP4
    in this moment I cannot verify at CRT monitor the output however -BF 2 causes a wrong green color for 1/2 seconds at the beginning of the output, I'm forced to set to 0.

    In the meantime I have try also the QSV encoder that seems resolve the problem of the "out of color"

    Code:
    ffmpeg64bitsett2016.exe -threads 12 -y -i c0113.mxf -filter_complex "[0:1] [0:2] amerge" -pix_fmt yuv420p -vf scale=interl=1,format=pix_fmts=yuv420p -c:v h264_qsv -global_quality 27 -level:v 4.1 -flags +ildct+ilme -top 1 -c:a ac3 -b:a 320k -ar 48000 -aspect 16:9 out56.MP4
    but randomly I get this error

    Image
    [Attachment 42308 - Click to enlarge]


    ffmpeg version N-81646-gc19da0c Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 5.4.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
    libavutil 55. 29.100 / 55. 29.100
    libavcodec 57. 55.101 / 57. 55.101
    libavformat 57. 48.103 / 57. 48.103
    libavdevice 57. 0.102 / 57. 0.102
    libavfilter 6. 62.100 / 6. 62.100
    libswscale 4. 1.100 / 4. 1.100
    libswresample 2. 1.100 / 2. 1.100
    libpostproc 54. 0.100 / 54. 0.100
    Guessed Channel Layout for Input Stream #0.1 : mono
    Guessed Channel Layout for Input Stream #0.2 : mono
    Guessed Channel Layout for Input Stream #0.3 : mono
    Guessed Channel Layout for Input Stream #0.4 : mono
    Guessed Channel Layout for Input Stream #0.5 : mono
    Guessed Channel Layout for Input Stream #0.6 : mono
    Guessed Channel Layout for Input Stream #0.7 : mono
    Guessed Channel Layout for Input Stream #0.8 : mono
    Input #0, mxf, from 'c0113.mxf':
    Metadata:
    uid : d9611000-5277-05c1-0270-08004602023b
    generation_uid : d9611000-5277-05c2-0270-08004602023b
    company_name : SONY
    product_name : Opt
    product_version : 1.22
    product_uid : 060e2b34-0401-0103-0e06-012002010300
    modification_date: 2016-12-30T11:55:30.000000Z
    material_package_umid: 0x060A2B340101010501010D4313000000549A160016780580 08004602023B0270
    timecode : 00:29:35:14
    Duration: 00:00:12.72, start: 0.000000, bitrate: 60347 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:3: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:4: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:5: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:6: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:7: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    Stream #0:8: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    [Parsed_amerge_0 @ 00000000022c5480] No channel layout for input 1
    [Parsed_amerge_0 @ 00000000022c5480] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
    Incompatible pixel format 'yuv420p' for codec 'h264_qsv', auto-selecting format 'nv12'
    [mp4 @ 00000000022e3b00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
    Output #0, mp4, to 'out56.MP4':
    Metadata:
    uid : d9611000-5277-05c1-0270-08004602023b
    generation_uid : d9611000-5277-05c2-0270-08004602023b
    company_name : SONY
    product_name : Opt
    product_version : 1.22
    product_uid : 060e2b34-0401-0103-0e06-012002010300
    modification_date: 2016-12-30T11:55:30.000000Z
    material_package_umid: 0x060A2B340101010501010D4313000000549A160016780580 08004602023B0270
    timecode : 00:29:35:14
    encoder : Lavf57.48.103
    Stream #0:0: Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, stereo, fltp, 320 kb/s (default)
    Metadata:
    encoder : Lavc57.55.101 ac3
    Stream #0:1: Video: h264 (h264_qsv) ([33][0][0][0] / 0x0021), nv12, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 0.04 fps, 12800 tbn, 25 tbc
    Metadata:
    file_package_umid: 0x060A2B340101010501010D431301D8874960100052770580 08004602023B0270
    encoder : Lavc57.55.101 h264_qsv
    Side data:
    cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: -1
    Stream mapping:
    Stream #0:1 (pcm_s24le) -> amerge:in0 (graph 0)
    Stream #0:2 (pcm_s24le) -> amerge:in1 (graph 0)
    amerge (graph 0) -> Stream #0:0 (ac3)
    Stream #0:0 -> #0:1 (mpeg2video (native) -> h264 (h264_qsv))
    Press [q] to stop, [?] for help
    [h264_qsv @ 00000000025a3560] EncodeFrameAsync returned -17
    Video encoding failed
    Conversion failed!

    Quote Quote  
  20. This is wrong for ffmpeg NVEnc
    Code:
    -pix_fmt yuv420p -vf scale=interl=1,format=pix_fmts=yuv420p
    This is right for ffmpeg NVEnc (NV12)
    Code:
    -vf scale=interl=1,format=pix_fmts=nv12



    Did you try update intel driver for QSV ? Are you using other application that is accessing QSV at same time ?

    Have you ever been able to successfully encode using ffmepg QSV ? Did you try rigaya's QSVENCC? If you can encode with that you know it's not a hardware/driver issue
    Quote Quote  
  21. Do you see difference?

    Here is 1:1 cropped

    Left is yuv420p , right is nv12
    Image Attached Images    
    Quote Quote  
  22. Member
    Join Date
    Nov 2009
    Location
    United States
    Search PM
    ffmpeg -h encoder=h264_nvenc
    ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
    built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609

    libavutil 55. 58.100 / 55. 58.100
    libavcodec 57. 89.100 / 57. 89.100
    libavformat 57. 71.100 / 57. 71.100
    libavdevice 57. 6.100 / 57. 6.100
    libavfilter 6. 82.100 / 6. 82.100
    libswscale 4. 6.100 / 4. 6.100
    libswresample 2. 7.100 / 2. 7.100
    libpostproc 54. 5.100 / 54. 5.100
    Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:
    General capabilities: delay
    Threading capabilities: none
    Supported pixel formats: yuv420p nv12 p010le yuv444p yuv444p16le bgr0 rgb0 cuda
    h264_nvenc AVOptions:
    -preset <int> E..V.... Set the encoding preset (from 0 to 11) (default medium)
    default E..V....
    slow E..V.... hq 2 passes
    medium E..V.... hq 1 pass
    fast E..V.... hp 1 pass
    hp E..V....
    hq E..V....
    bd E..V....
    ll E..V.... low latency
    llhq E..V.... low latency hq
    llhp E..V.... low latency hp
    lossless E..V....
    losslesshp E..V....
    -profile <int> E..V.... Set the encoding profile (from 0 to 3) (default main)
    baseline E..V....
    main E..V....
    high E..V....
    high444p E..V....
    -level <int> E..V.... Set the encoding level restriction (from 0 to 51) (default auto)
    auto E..V....
    1 E..V....
    1.0 E..V....
    1b E..V....
    1.0b E..V....
    1.1 E..V....
    1.2 E..V....
    1.3 E..V....
    2 E..V....
    2.0 E..V....
    2.1 E..V....
    2.2 E..V....
    3 E..V....
    3.0 E..V....
    3.1 E..V....
    3.2 E..V....
    4 E..V....
    4.0 E..V....
    4.1 E..V....
    4.2 E..V....
    5 E..V....
    5.0 E..V....
    5.1 E..V....
    -rc <int> E..V.... Override the preset rate-control (from -1 to INT_MAX) (default -1)
    constqp E..V.... Constant QP mode
    vbr E..V.... Variable bitrate mode
    cbr E..V.... Constant bitrate mode
    vbr_minqp E..V.... Variable bitrate mode with MinQP
    ll_2pass_quality E..V.... Multi-pass optimized for image quality (only for low-latency presets)
    ll_2pass_size E..V.... Multi-pass optimized for constant frame size (only for low-latency presets)
    vbr_2pass E..V.... Multi-pass variable bitrate mode
    -rc-lookahead <int> E..V.... Number of frames to look ahead for rate-control (from -1 to INT_MAX) (default -1)
    -surfaces <int> E..V.... Number of concurrent surfaces (from 0 to 64) (default 32)
    -cbr <boolean> E..V.... Use cbr encoding mode (default false)
    -2pass <boolean> E..V.... Use 2pass encoding mode (default auto)
    -gpu <int> E..V.... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)
    any E..V.... Pick the first device available
    list E..V.... List the available devices
    -delay <int> E..V.... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)
    -no-scenecut <boolean> E..V.... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)
    -forced-idr <boolean> E..V.... If forcing keyframes, force them as IDR frames. (default false)
    -b_adapt <boolean> E..V.... When lookahead is enabled, set this to 0 to disable adaptive B-frame decision (default true)
    -spatial-aq <boolean> E..V.... set to 1 to enable Spatial AQ (default false)
    -temporal-aq <boolean> E..V.... set to 1 to enable Temporal AQ (default false)
    -zerolatency <boolean> E..V.... Set 1 to indicate zero latency operation (no reordering delay) (default false)
    -nonref_p <boolean> E..V.... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)
    -strict_gop <boolean> E..V.... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)
    -aq-strength <int> E..V.... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)
    -cq <int> E..V.... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)
    -aud <boolean> E..V.... Use access unit delimiters (default false)
    -bluray-compat <boolean> E..V.... Bluray compatibility workarounds (default false)
    -init_qpP <int> E..V.... Initial QP value for P frame (from -1 to 51) (default -1)
    -init_qpB <int> E..V.... Initial QP value for B frame (from -1 to 51) (default -1)
    -init_qpI <int> E..V.... Initial QP value for I frame (from -1 to 51) (default -1)
    -qp <int> E..V.... Constant quantization parameter rate control method (from -1 to 51) (default -1)


    As you can see there is the "-cq" command to set target quality.
    Quote Quote  
  23. Originally Posted by gregalan View Post
    As you can see there is the "-cq" command to set target quality.

    I don't think it works, maybe not implemented properly yet. Or do you have to set some other settings as well ?

    -cq 0 => 1.9Mb/s
    -cq 18 => 1.9Mb/s
    -cq 26 => 1.9Mb/s
    -cq 40 => 1.6Mb/s

    There is a change at 40 , but it's unwatchable at that bitrate
    Quote Quote  
  24. Member
    Join Date
    Nov 2009
    Location
    United States
    Search PM
    I used
    Code:
    -c:v h264_nvenc -preset slow -cq 16 -rc-lookahead 16 -qmin 10 -qmax 23 -refs 4
    and
    Code:
    -c:v h264_nvenc -preset slow -cq 20 -rc-lookahead 16 -qmin 10 -qmax 23 -refs 4
    I got very different bitrates on a very small test video.

    -cq 16 => 848.2kbits/s and q=9.0
    -cq 20 => 592.8kbits/s and q=13.0

    I might be wrong but I think -cq option only works with FFmpeg 3.3 or newer.
    Last edited by gregalan; 14th Jul 2017 at 10:55.
    Quote Quote  
  25. Yes, that works - setting qmin, qmax is required
    Quote Quote  
  26. Where source is this 422 video file:

    https://www.dropbox.com/s/829iziwuetpdqm4/source422.MXF?dl=0

    I get this x264.MP4 (attached) using:
    Code:
    ffmpeg64bitjuly2017.exe -threads 12 -y -i source422.mxf -pix_fmt yuv420p -vf scale=interl=1 -c:v libx264 -profile:v high -level:v 4.1 -g 33 -bf 2 -crf 22 -flags +ildct+ilme -top 1 -aspect 16:9 -an x264.MP4
    quality is good: encoder is x264, file size 22 MB.

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Try to encode using QSV (attached):

    Code:
    ffmpeg64bitjuly2017.exe -threads 12 -y -i source422.mxf -pix_fmt nv12 -vf scale=interl=1,format=pix_fmts=nv12 -c:v h264_qsv -global_quality 27.5 -level:v 4.1 -flags +ildct+ilme -top 1 -aspect 16:9 -an QSV.MP4
    quality is good: encoder is Quick Sync, file size almost 22 MB

    But: using the same untouched commandline sometimes work, sometimes freeze during encoding, sometimes return error (error during encoding: device failed (-17)) also changing the Intel HD4600 graphic drivers on my pc

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Try to encode using NVENC (attached):

    Code:
    ffmpeg64bitjuly2017.exe -threads 12 -y  -i source422.mxf -pix_fmt nv12 -vf scale=interl=1,format=pix_fmts=nv12 -c:v h264_nvenc -preset slow -cq 20 -qmin 10 -qmax 26 -refs 4 -profile:v high -level:v 4.1 -flags +ildct+ilme -top 1 -aspect 16:9 -an NVENC.MP4
    file size is alwais 22MB. Quality is not bed but in the frame by frame comparison, seems that there is too many loss of details.

    If I try to add -rc-lookahead 16 in the commandline I get [h264_nvenc @ 00000000023ac520] No NVENC capable devices found

    However the problem is the loss of details

    So is there a way to improove the quality of this NVENC encoding? thanks
    Image Attached Files
    Quote Quote  
  27. I try -cq at different value but does not change the final size: seems that the bitrate change changing the -qmax value
    Quote Quote  
  28. And there is a strange things in the NVENC output:

    General
    Complete name : V:\C0122\NVENC.MP4
    Format : MPEG-4
    Format profile : Base Media
    Codec ID : isom
    File size : 22.1 MiB
    Duration : 14s 80ms
    Overall bit rate mode : Variable
    Overall bit rate : 13.2 Mbps
    Writing application : Lavf57.75.100

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Main@L4.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 4 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 14s 80ms
    Bit rate mode : Variable
    Bit rate : 13.2 Mbps
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 25.000 fps
    Original frame rate : 50.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Interlaced
    Bits/(Pixel*Frame) : 0.254
    Stream size : 22.1 MiB (100%)


    Is there a way to don't see the Original Framerate = 50 ?
    Quote Quote  
  29. Originally Posted by marcorocchini View Post

    Is there a way to don't see the Original Framerate = 50 ?
    just don't look at it




    I think that's what nvenc does with interlaced video. rigaya's nvencc does that too for the "original frame rate". Maybe you can patch it after
    Quote Quote  
  30. Member
    Join Date
    Nov 2009
    Location
    United States
    Search PM
    Originally Posted by

    file size is alwais 22MB. Quality is not bed but in the frame by frame comparison, seems that there is too many loss of details.

    If I try to add [B
    -rc-lookahead 16[/B] in the commandline I get [h264_nvenc @ 00000000023ac520] No NVENC capable devices found

    However the problem is the loss of details

    So is there a way to improove the quality of this NVENC encoding? thanks
    Your GT 750M is first gen nvenc so it may not support some options, also quality wasn't very good with Kepler GPUs.
    Quote Quote  



Similar Threads

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