[FFmpeg-trac] #11390(ffmpeg:closed): av1_nvenc output frames sometimes cannot be decoded
FFmpeg
trac at avcodec.org
Fri Aug 15 17:56:08 EEST 2025
#11390: av1_nvenc output frames sometimes cannot be decoded
------------------------------------+-----------------------------------
Reporter: nikomo | Owner: (none)
Type: defect | Status: closed
Priority: normal | Component: ffmpeg
Version: git-master | Resolution: invalid
Keywords: av1_nvenc | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+-----------------------------------
Comment (by cheppizzadrakon):
Hello, I have reported the same issue in
https://trac.ffmpeg.org/ticket/10909
This is still an issue on the latest release (ffmpeg version 2025-08-14
-git-cdbb5f1b93-full_build-www.gyan.dev)
Instead of relying on external players, I have used ffmpeg directly to
test the decoding
{{{
ffmpeg.exe -y -hwaccel cuda -i debug_av1_nvenc.mkv -f null -
}}}
This produces the same error as seen by you in mpv
{{{
[av1 @ 0000027989a5a240] trailing_zero_bit out of range: 1, but must be in
[0,0].
[av1 @ 0000027989a5a240] Failed to read unit 1 (type 5).
[av1 @ 0000027989a5a240] Failed to read packet.
[vist#0:0/av1 @ 0000027989a802c0] [dec:av1 @ 0000027989a7a580] Error
submitting packet to decoder: Invalid data found when processing input
[av1 @ 0000027989a5a240] trailing_one_bit out of range: 0, but must be in
[1,1].
[av1 @ 0000027989a5a240] Failed to read unit 0 (type 5).
[av1 @ 0000027989a5a240] Failed to read packet.
}}}
Which ultimately fails
{{{
[vist#0:0/av1 @ 0000027989a802c0] [dec:av1 @ 0000027989a7a580] Decode
error rate 1 exceeds maximum 0.666667
[vist#0:0/av1 @ 0000027989a802c0] [dec:av1 @ 0000027989a7a580] Task
finished with error code: -1145393733 (Error number -1145393733 occurred)
[vist#0:0/av1 @ 0000027989a802c0] [dec:av1 @ 0000027989a7a580] Terminating
thread with return code -1145393733 (Error number -1145393733 occurred)
[vost#0:0/wrapped_avframe @ 0000027989a7e600] No filtered frames for
output stream, trying to initialize anyway.
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf61.1.100
Chapters:
Chapter #0:0: start 0.033000, end 1.250000
Metadata:
title : Intro
Stream #0:0(jpn): Video: wrapped_avframe, yuv420p(progressive),
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 1k tbn
(default)
Metadata:
title : JPNBD
DURATION : 00:00:01.505000000
BPS : 34918000
NUMBER_OF_FRAMES: 34141
NUMBER_OF_BYTES : 6215251315
_STATISTICS_WRITING_APP: mkvmerge v88.0 ('All I Know') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-11-10 11:06:16
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc61.3.100 wrapped_avframe
Stream #0:1(jpn): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
(default)
Metadata:
title : PCM 2.0
DURATION : 00:00:01.253000000
BPS : 2304000
NUMBER_OF_FRAMES: 284793
NUMBER_OF_BYTES : 410101920
_STATISTICS_WRITING_APP: mkvmerge v88.0 ('All I Know') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2024-11-10 11:06:16
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc61.3.100 pcm_s16le
[out#0/null @ 00000279899ef840] video:0KiB audio:238KiB subtitle:0KiB
other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 0 fps=0.0 q=0.0 Lsize=N/A time=N/A bitrate=N/A speed=N/A
Conversion failed!
}}}
I think the difference in behavior between mpv and VLC is because mpv
automatically falls back to the software decoder if the hardware one
fails: opening the Stats for nerds menu, a working av1 video shows
{{{
Video: Alliance for Open Media AV1 [Main] HW: d3d11va
}}}
while the broken video shows
{{{
Video: Alliance for Open Media AV1 [Main] [libdav1d]
}}}
The cuvid decoders solve this issue: the av1 video will be decoded
correctly when running
{{{
ffmpeg -c:v av1_cuvid -i debug_av1_nvenc.mkv -f null -
}}}
Also, using hevc_cuvid in the two-step example from above will produce an
av1 video which can be played with -hwaccel cuda without needing av1_cuvid
(i had to remove -tune:v uhq from the command since it produced a 0-bytes
file)
{{{
.\ffmpeg.exe -y -c:v hevc_cuvid -i tmp.mkv -c:v av1_nvenc -preset:v p7
-rc:v vbr -b:v 0 -multipass:v 2 -rc-lookahead:v 30 -lookahead_level:v 15
-split_encode_mode:v 1 -cq:v 30 -c:a copy -c:s copy -c:d copy debug.mkv
}}}
As I wrote in my issue, also reencoding with a software codec like libx264
or libx265 before encoding again with av1_nvenc will produce a playable
result
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11390#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list