Jump to content

Error with videos containing delayed audio in web app


Recommended Posts

thecoache
Posted

Hello,

I did not find another thread related to this issue. If one exists, I apologize. I put this thread in the Web App client section as that is the only platform I was able to test and confirm this issue on.

It seems Emby has a hard time dealing with files containing audio tracks with a positive delay on some platforms.

I noticed that a few specific movies I encoded and made available on Emby would fail to play. It would load 1 or 2 seconds, show the buffering spinning wheel animation, load another second, show the spinning wheel again and finally exit the video with a "Playback Error No compatible streams are currently available." error. When seeking a few minutes into the movies, the video would play fine from that point on. It is also possible for Emby to manage to power through if the delay is small enough(3 seconds at most in my case).

When I investigated all the impacted files, I noticed that all of them had a delay on the audio track. So to test this theory, I created a silence file the length of the delay(6001ms in this case) and merged it with the regular movie audio track.

This is the flow I used to create the padded audio file(I used ChatGPT for help with these commands. I don't know if there is a better set of parameters to do this, but these worked):

  • Extract all the files from the MKV(I used gMKVExtractGUI).

  • Create a silence file with the command
    ffmpeg -f lavfi -t 6.001 -i anullsrc=channel_layout=5.1:sample_rate=48000 -c:a ac3 -b:a 640k silence.ac3

  • Create a file list.txt containing the following:

file 'silence.ac3'
file 'audio.ac3'
  • Concatenate the silence and movie audio files with the command
    ffmpeg -f concat -safe 0 -i list.txt -c copy padded.ac3

  • Mux the video file, padded.ac3, subtitles and chapters into a new mkv with MKVToolNix.

With this, the audio delay shown in MediaInfo was 0ms and the audio remained in sync with the movie and can be played fine on the Emby web app.

I don't know if there's a better way to remove the delay while keeping the audio in sync with the video. This is the one way I managed to achieve it to "correct" the issue on Emby.

I attached two 30 seconds sample files, although the issue is seen within the first 5 seconds:
Test_WithDelayAudio.mkv - This video contains the delayed audio of 6001ms. This fails to play initially in the Emby web app.
Test_WithPaddedAudio.mkv - This video contains the padded audio instead of the delayed one. This plays fine.

I also tested having the two audio files in the same mkv and indeed, when selecting the track with the delay, the issue happens whereas it doesn't when selecting the track with the padding.

As for the logs, Emby seems to create 3 transcode logs when attempting to play the test file with the delayed audio.

I'm running Emby Server 4.9.3.0 on Debian and I'm playing the files through the web app on Windows 10 on both Firefox and Chrome.

Thanks.

embyserver.txt ffmpeg-transcode-ae9321fc-59d8-4367-8389-2c7cb5f7911b_1.txt ffmpeg-transcode-becd5750-9b6a-433a-b419-2219fa53de65_1.txt ffmpeg-transcode-c5ecb4d6-b68e-4c27-89b4-0c4067b1bc15_1.txt Test_WithDelayAudio.mkv Test_WithPaddedAudio.mkv

visproduction
Posted

Possibly related:

https://help.mkvtoolnix.download/t/how-do-i-change-sync-values-manually/556

As shifting by a negative amount will lose you data (Matroska doesn’t allow negative timestamps, therefore all frames will be discarded if their timestamps are negative after the shift), you can also apply the reverse shift to the video track: making it later by 500ms vs. the unmodified audio track.

thecoache
Posted

Right. Adding a negative delay to the video file gives the same result of having no audio delay necessary and the video/audio remains in sync.

However, I bump into this issue most often when I graft an extra audio track from a DVD or bluray in my collection to a new 4k release that only has english audio. This means the english track has no delay, but the extra track can, depending mostly on what studios appear at the start of each version of a movie. The negative video delay is not an option in this situation.

As things are now, my options to play a video on the web app with one such grafted audio track that has a delay is to either start the video with an audio track with no delay(if there is one) until the video passes the delay set on the second audio track and then switch to that track, or, start the video with that second track immediately and seek a minute ahead before the stream crashes with a "No compatible streams are currently available." error.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...