#10332 closed defect (fixed)

Transcodes using hevc_nvenc not copying audio as expected to the output

Reported by: Jordan Fearnley Owned by:
Priority: minor Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Jordan Fearnley)

Summary of the bug:

Since commit 9a245bdf5d7860b8bc5e5c21a105a075925b719a, transcodes using -c:v hevc_nvenc -c:a copy do not appear to copy over audio in the exact same manner as it did previously. In some limited playback scenarios, the resulting transcoded file's audio track can end up not being played at all.

How the bug was discovered:

Audio playback issues were encountered when playing a file via Jellyfin on an LG TV. I could not reproduce this playback issue on any other client as impacted transcodes playback fine on players tested on my PC, and even playback fine when served via Jellyfin on a android client. The impacted transcodes have all had a source framerate of 23.98fps.

When using ffprobe -show_streams -select_streams a to try diagnose the issue, I observed that when the audio was 'copied' over during the transcode, any impacted files would have the profile set to unknown, rather than the expected (in this situation) value of LC.

Additionally, the ffprobe output also indicated that the values for duration_ts & duration went from N/A in non-impacted files, to the actual expected values in impacted files.

Available logfile output:

https://gist.github.com/fearnlj01/e1a72c2b3aaa9666922bd4106efcb3d8

This gist contains 4x files, as listed below. These files have also been attached to this ticket.

nvenc-audioprofile-unknown-probe.log | Impacted transcode, ffprobe audio stream output
nvenc-audioprofile-unknown-ffmpeg.log | Impacted transcode, ffmpeg output

nvenc-audioprofile-aac_lc-ffmepg.log | Non-impacted transcode, ffprobe audio stream output
nvenc-audioprofile-aac_lc-probe.log | Non-impacted transcode, ffmpeg output

I also have the 30s source file used for the above transcodes which I will try to attach to the ticket with filename of nvenc-audioprofile-source.mkv.

Steps for reproduction of the issue:

Note that the issue seems to only appear when using NVENC, so an appropriately capable gpu would be required to reproduce. This should, at the least, be specifically reproducible when using an Nvidia GeForce RTX 3060 Ti.

ffmpeg -i nvenc-audioprofile-source.mkv -c:v hevc_nvenc -c:a copy -y -f matroska output.mkv"

  • Using ffprobe -show_streams -select_streams a output.mkv, verify that the output file has the expected encoding profile set for the audio stream


  • Using a build of ffmpeg which includes the aforementioned commit:

ffmpeg -i nvenc-audioprofile-source.mkv -c:v hevc_nvenc -c:a copy -y -f matroska output.mkv"

  • Using ffprobe -show_streams -select_streams a output.mkv, verify that the output file does not have the expected encoding profile set for the audio stream

I am unsure as to what steps can be taken to reproduce the core issue of the audio track not being used for playback, however I suspect that this would be out of scope for FFMPEG even if easily reproducible. I would however expect that ffprobe should be able to show the audio encoding profile not as unknown, especially when copying from an AAC source with profile LC.

Attachments (4)

nvenc-audioprofile-aac_lc-ffmepg.log (676.8 KB ) - added by Jordan Fearnley 19 months ago.
Non-impacted transcode - FFMPEG output
nvenc-audioprofile-aac_lc-probe.log (1.2 KB ) - added by Jordan Fearnley 19 months ago.
Non-impacted transcode - ffprobe output
nvenc-audioprofile-unknown-ffmpeg.log (871.3 KB ) - added by Jordan Fearnley 19 months ago.
Impacted transcode - FFMPEG output
nvenc-audioprofile-unknown-probe.log (1.2 KB ) - added by Jordan Fearnley 19 months ago.
Impacted transcode - ffprobe output

Download all attachments as: .zip

Change History (10)

by Jordan Fearnley, 19 months ago

Non-impacted transcode - FFMPEG output

by Jordan Fearnley, 19 months ago

Non-impacted transcode - ffprobe output

by Jordan Fearnley, 19 months ago

Impacted transcode - FFMPEG output

by Jordan Fearnley, 19 months ago

Impacted transcode - ffprobe output

comment:1 by Jordan Fearnley, 19 months ago

Description: modified (diff)

comment:2 by Jordan Fearnley, 19 months ago

The sample source media that was used for testing conducted thus far has been uploaded to streams.videolan.org/upload/ (as per the guidance in https://ffmpeg.org/bugreports.html). This should have a filename of nvenc-audioprofile-source.mkv, and should also (hopefully) be linked to this ticket.

comment:3 by hydra3333, 18 months ago

is it only hevc, or is h264 affected as well ?

comment:4 by Jordan Fearnley, 18 months ago

I've just done another test run now with -c:v h264_nvenc to confirm, albeit using a different input source. I get the same issue as initially reported when doing it this way as well so it appears this isn't just limited to hevc.

I also sent off the binaries of ffmpeg I've been using to test this over to an associate who has a 40 series GPU, and it looks like this issue does not occur when using -c:v av1_nvenc. The same issue could still be reproduced when using -c:v hevc_nvenc on this other device, so it looks like it's just h264 & hevc that are impacted.

For the sake of completeness, I've done a quick test using -c:v libx265 to ensure that this issue doesn't occur - outcome is as expected and there are no problems occuring in this scenario.

comment:5 by Balling, 17 months ago

Should be fixed, because revert occured: ac7c265b33b52f914ebe05e581bbe9343eca1186

Last edited 17 months ago by Balling (previous) (diff)

comment:6 by Jordan Fearnley, 17 months ago

Resolution: fixed
Status: newclosed

Tried it out and everything appears to be normal once again on my end 🥳

Note: See TracTickets for help on using tickets.