Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H.264 encode doesn't automatically choose appropriate profile level and throws error #266

Open
will-neithan opened this issue Feb 1, 2025 · 1 comment

Comments

@will-neithan
Copy link

Hello,

I have a .mkv H.264 NVENC file recorded in OBS with 223000 constant bitrate with automatically assigned High 5.1 profile. When I want to reencode this file in Shutter Encoder to .mp4 with the same parameters H.264 NVENC 223000 CBR, it throws error. When I force profile to Main 6.1 reencode finishes successfully. I know that the maximum bitrate for levels 5.1, 5.2, 6 is 240000 kbps, so that would be my guess, that it is too close and it is a problem. Nevertheless, I guess the app should be able to handle it automatically. I tried the same reencode in Handbrake and it automatically adjusted to Main 6.1. Thank you for your work.

-hwaccel auto -strict -2 -v quiet -hide_banner -ss 0ms -i "C:\Users\ADAM\Documents\Adam\Projects\Streams\OBS Recording Editing Lag\sources\nfs_cbr_223k_obs-rec-mkv.mkv" -filter_complex "[0:v]scale=684:384:sws_flags=bilinear:sws_dither=none[v];[0:a:0]showvolume=f=0:w=684:h=4:t=0:b=0:v=0:o=v:s=0:p=0.5[volume];[v][volume]overlay=W-w:H-h" -r 60.0 -c:v bmp -an -f image2pipe -
Input #0, lavfi, from 'nullsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf61.9.101
  Stream #0:0: Video: h264 (Main), yuv420p(tv, progressive), 640x360 [SAR 3:4 DAR 4:3], q=2-31, 2000 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc61.28.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
[out#0/null @ 000001f946b53a40] video:1KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=   25 fps=0.0 q=12.0 Lsize=N/A time=00:00:00.88 bitrate=N/A speed=2.99x    

Input #0, lavfi, from 'nullsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_qsv))
Press [q] to stop, [?] for help
[h264_qsv @ 0000019f8a576340] Error initializing a MFX session: unsupported (-3)
[h264_qsv @ 0000019f8a576340] The current mfx implementation is not supported, try next mfx implementation.
 -hwaccel auto -strict -2 -v quiet -hide_banner -ss 0ms -i "C:\Users\ADAM\Documents\Adam\Projects\Streams\OBS Recording Editing Lag\sources\nfs_cbr_223k_obs-rec-mkv.mkv" -filter_complex "[0:v]scale=1256:704:sws_flags=bilinear:sws_dither=none[v];[0:a:0]showvolume=f=0:w=1256:h=7:t=0:b=0:v=0:o=v:s=0:p=0.5[volume];[v][volume]overlay=W-w:H-h" -r 60.0 -c:v bmp -an -f image2pipe -
[h264_qsv @ 0000019f8a576340] Error initializing a MFX session: unsupported (-3)
[vost#0:0/h264_qsv @ 0000019f8a5546c0] [enc:h264_qsv @ 0000019f8a550400] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0000019f8a576f80] Error sending frames to consumers: Function not implemented
[vf#0:0 @ 0000019f8a576f80] Task finished with error code: -40 (Function not implemented)
[vf#0:0 @ 0000019f8a576f80] Terminating thread with return code -40 (Function not implemented)
[vost#0:0/h264_qsv @ 0000019f8a5546c0] [enc:h264_qsv @ 0000019f8a550400] Could not open encoder before EOF
[vost#0:0/h264_qsv @ 0000019f8a5546c0] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_qsv @ 0000019f8a5546c0] Terminating thread with return code -22 (Invalid argument)
[out#0/null @ 0000019f8a553cc0] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    
Conversion failed!

Input #0, lavfi, from 'nullsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_amf))
Press [q] to stop, [?] for help
[h264_amf @ 0000014f665e6700] CreateComponent(AMFVideoEncoderVCE_AVC) failed with error 13
[vost#0:0/h264_amf @ 0000014f665c46c0] [enc:h264_amf @ 0000014f665bfbc0] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0000014f665e6940] Error sending frames to consumers: Encoder not found
[vf#0:0 @ 0000014f665e6940] Task finished with error code: -1129203192 (Encoder not found)
[vf#0:0 @ 0000014f665e6940] Terminating thread with return code -1129203192 (Encoder not found)
[vost#0:0/h264_amf @ 0000014f665c46c0] [enc:h264_amf @ 0000014f665bfbc0] Could not open encoder before EOF
[vost#0:0/h264_amf @ 0000014f665c46c0] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_amf @ 0000014f665c46c0] Terminating thread with return code -22 (Invalid argument)
[out#0/null @ 0000014f665c3f00] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    
Conversion failed!

Input #0, lavfi, from 'nullsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_vulkan))
Press [q] to stop, [?] for help
[h264_vulkan @ 0000014a6a01f440] No rate control settings specified, using fixed QP = 18
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf61.9.101
  Stream #0:0: Video: h264 (High), vulkan(progressive), 320x240 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc61.28.100 h264_vulkan
[out#0/null @ 0000014a69fe8900] video:1KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=   25 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.96 bitrate=N/A speed=34.6x    


Command: -strict -2 -hide_banner -threads 0 -hwaccel auto -i "C:\Users\ADAM\Documents\Adam\Projects\Streams\OBS Recording Editing Lag\sources\nfs_cbr_223k_obs-rec-mkv.mkv" -c:v h264_nvenc -b_ref_mode 0 -b:v 222993k -rc cbr -preset p7 -profile:v high -level 5.1 -map v:0 -c:a aac -ar 48k -b:a 320k -map a:0 -pix_fmt yuv420p -x264opts nal-hrd=cbr:force-cfr=1 -minrate 222993k -maxrate 222993k -bufsize 445986k -sws_flags bicubic -metadata creation_time="2025-02-01T00:25:27.309275500Z" -y "C:\Users\ADAM\Documents\Adam\Projects\Streams\OBS Recording Editing Lag\sources\nfs_cbr_223k_obs-rec-mkv_shutter.mp4"
Input #0, matroska,webm, from 'C:\Users\ADAM\Documents\Adam\Projects\Streams\OBS Recording Editing Lag\sources\nfs_cbr_223k_obs-rec-mkv.mkv':
  Metadata:
    ENCODER         : Lavf60.3.100
  Duration: 00:00:50.20, start: 0.000000, bitrate: 226094 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:00:50.204000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : Track1
      DURATION        : 00:00:50.155000000
[vist#0:0/h264 @ 000002821c6c0e00] [dec:h264 @ 000002821b1af680] Using auto hwaccel type dxva2 with new default device.
[out#0/mp4 @ 000002821b4b6e80] Codec AVOption x264opts (x264 options) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some decoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_nvenc @ 000002821bd71240] InitializeEncoder failed: invalid param (8): Invalid Level.
[vost#0:0/h264_nvenc @ 000002821be35a80] [enc:h264_nvenc @ 00000282195b4600] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 000002821bd71600] Error sending frames to consumers: Invalid argument
[vf#0:0 @ 000002821bd71600] Task finished with error code: -22 (Invalid argument)
[vf#0:0 @ 000002821bd71600] Terminating thread with return code -22 (Invalid argument)
[vost#0:0/h264_nvenc @ 000002821be35a80] [enc:h264_nvenc @ 00000282195b4600] Could not open encoder before EOF
[vost#0:0/h264_nvenc @ 000002821be35a80] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_nvenc @ 000002821be35a80] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 000002821b4b6e80] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    
[aac @ 000002821b4a6300] Qavg: 63414.820
Conversion failed!
@paulpacifico
Copy link
Owner

Thanks I'm correcting this for the next release.

Paul.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants