Jump to content

Audio distortion when playing Dolby Vision mp4 with DD+ Atmos


Ceten

Recommended Posts

Ceten

Hi, I'm having issues with playing this one file from the Emby app on my LG C7 tv (app version 1.0.24) using the internal speakers. Around 2 minutes in the audio starts to be distorted; On my laptop the file plays with clear audio but to be sure the error wasn't in the file itself I've put it on an usb stick. When opening the file from the thumb drive directly on the tv (in the built in videos app) it played without issues (except for not being able to select the subtitle because the default player only allows selection of the first 8 subtitles).

Media playback is set to only allow transcoding because a lot of my files have true hd as the default track and that's easier than explaining to my girlfriend to select a different audio stream. This way the tv switches to the next available audio stream automatically. In the dashboard the file reports to be direct playing, the playback reporting plugin marks it as direct streaming.
afbeelding.thumb.png.4f1a95786b8d905c9435577e05828c9b.png

Attached is the server log and the full media info for the file. I first tried to play the file around 2021-04-19 13:01 (skipped the playback a bit forward because the audio distortion only starts at around 2 minutes). A bit later I turned on debug logging and tried again.
I also tried to check what happens if opening the file using DLNA, but this results in transcoding.
Last thing I tried was updating the tv to firmware 5.00.60 which I had postponed for a while, but this didn't change anything.

Any idea what might be the problem?

media info.txt embyserver.txt

Link to comment
Share on other sites

SamES

I think I've got this same file but as an mkv, not an mp4.  Did you convert it to mp4, or is that the original format?  My file plays fine

A few questions:

  • Are you trying to play subs?  If so, turn them all off and see if it still has problems
  • Why have you turned off all the transcoding/re-encoding options?  When you do this you are forcing clients to DirectPlay in formats that are generally known not to work correctly.
  • If you turn these options back on, does it still DirectPlay?  If not, can you attach the ffmpeg logs as this will give us a better picture of what's going on.
Link to comment
Share on other sites

Ceten

It's the original file, I didn't convert it. As I understood these files are mp4 because they contain Dolby Vision, it was the same for WandaVision and I also have some movies like Wonder Woman 1984 which include both Dolby Vision and (lossy) Dolby Atmos. All of them played without issue so far except for this one.

Regarding turning of the transcoding/re-encoding options, I've done this so I don't need to remind my girlfriend not to select TrueHD audio tracks or edit every file to change the default audio track.
These TrueHD tracks are often the default tracks, but would result in transcoding as the LG oled tv's do not support them.
With the options turned off the tv automatically plays the next audio track which results in the files playing automatically using directplay.
That's fine for our use case as we only really use Emby on the tv and it handles everything I've thrown at it except for TrueHD audio and PGS subs (that's an easy fix as srt's are downloaded automatically and then used by default).
I think I posted a request a while back to automatically select a different track than TrueHD in the LG app but I don't think this was ever implemented.

Anyway I tried playing without subs but this resulted in the same error, then I turned on all the transcoding and re-encoding options, but the file still direct plays with the same audio distortion:
afbeelding.png.58b0d00f14d94d815ed9cd99e3190d6e.png

I've included the new log file and a video of the file playing on the tv. It's not very clear but you can hear the audio falling away regularly. This doesn't occur when playing the file from usb.

embyserver(1).txt

Edited by Ceten
typo
Link to comment
Share on other sites

SamES

OK, that all makes sense.  Thanks for clarifying.

If it is just this file that has the audio issue then I'm not really sure what options we have.  If it is DirectPlaying then the server and client are not really doing anything to the file.  It doesn't look like a really high bitrate file, so I can't see network speed being an issue.

I don't have any ideas, maybe @rbjtech may have some suggestions.  

You could try copying the streams to a new mp4 container, and if that doesn't work, try copying just the video and audio streams (no subs) to a new mp4 container.  I have seen files with lots of subs have playback issues.

 

  • Like 1
Link to comment
Share on other sites

roaku

Have you compared the bitrate for the eac3 audio of this file to the ones that are working correctly?

I know I have to reduce the audio bitrate of my rips to avoid audio dropouts when direct playing, although I use the Roku app.

I think 640 kb/s is the highest I've been able to go with eac3.

Edited by roaku
Link to comment
Share on other sites

rbjtech

So looking at the log - I have noticed something interesting.   

Starting @ 13:59 until 14:12 - the value of SqliteItemRepository: GetItems query time (slow) slowly increases from approx 1 second to 2.6 seconds.  If you look at the polling interval of these requests, they are every 2-3 seconds - the same time the audio stutters...

Any delay beyond a few hundred microseconds may be delaying the buffering process somewhere ?

Could this be related ?  I'm not 100% sure what this log entry is even doing - but as it repeats consistently, it's having a big system impact.

Have you tried disabling the DLNA features in emby ?  What plugins do you have loaded ?

GetItems query time (slow): 2575ms. Query: select A.type,A.data,A.Id,A.StartDate,A.EndDate,A.IsMovie,A.IsSeries,A.IsRepeat,A.CommunityRating,A.CustomRating,A.IndexNumber,A.IsLocked,A.PreferredMetadataLanguage,A.PreferredMetadataCountryCode,A.Width,A.Height,A.DateLastRefreshed,A.Name,A.Path,A.PremiereDate,A.Overview,A.ParentIndexNumber,A.ProductionYear,A.OfficialRating,A.ForcedSortName,A.RunTimeTicks,A.Size,A.Container,A.DateCreated,A.DateModified,A.guid,A.Genres,A.ParentId,A.IsInMixedFolder,A.DateLastSaved,A.LockedFields,A.Studios,A.Tags,A.OriginalTitle,A.CriticRating,A.IsVirtualItem,A.SeriesName,A.Album,A.AlbumId,A.SeriesId,A.PresentationUniqueKey,A.InheritedParentalRatingValue,A.Tagline,A.ProviderIds,A.Images,A.ProductionLocations,A.TotalBitrate,A.Artists,A.AlbumArtists,A.ExternalId,A.SeriesPresentationUniqueKey,A.Status,A.DisplayOrder,A.ThreeDFormat,UserDatas.Rating,UserDatas.IsFavorite,UserDatas.Played,UserDatas.PlayCount,UserDatas.PlaybackPositionTicks,UserDatas.LastPlayedDateInt,UserDatas.AudioStreamIndex,UserDatas.SubtitleStreamIndex from MediaItems A left join UserDatas on A.UserDataKeyId=UserDatas.UserDataKeyId And (UserDatas.UserId=@UserId) where IsFolder=@IsFolder AND IsVirtualItem=@IsVirtualItem AND MediaType=@MediaTypes AND TopParentId in (8,5,6,4,7) Group by PresentationUniqueKey ORDER BY SortName collate NATURALSORT ASC LIMIT 30 OFFSET 11280

This is the query which gets run every 2-3 seconds - what is it doing ?!

edit - also noticed this is being reported as a 24fps file, as opposed to a 23.976fps.  Are the other files that play ok also 24fps ?

Edited by rbjtech
  • Like 1
Link to comment
Share on other sites

Try removing these plugins:

	Addic7ed 1.0.8.0
	Statistics 2.0.19.0

Then restart the server and see if performance improves.

Link to comment
Share on other sites

Ceten

These are all the plugins I had installed:

  • Addic7ed: 1.0.8.0
  • Auto Box Sets: 1.2.5.0
  • Auto Organize: 1.5.9.0
  • Bluray Folder Support: 1.0.0.0
  • Cinema Intros: 1.0.35.0
  • Dlna: 1.0.39.0
  • Dvd Folder Support: 1.0.0.0
  • Fanart.tv: 1.0.10.0
  • IMVDb: 1.0.9.0
  • MovieDb: 1.3.8.0
  • MusicBrainz: 1.0.13.0
  • Nfo Metadata: 1.0.34.0
  • OMDb: 1.0.12.0
  • Open Subtitles: 1.0.27.0
  • Playback Reporting: 1.7.0.3
  • Port Mapper: 1.0.4.0
  • Reports: 1.0.44.0
  • Server Configuration Backup: 1.4.5.0
  • Statistics: 2.0.19.0
  • Studio Images: 1.0.3.0
  • TheAudioDb: 1.0.11.0
  • TheTVDB: 1.0.36.0
  • Webhooks: 1.0.14.0

I've uninstalled the Addic7ed, Statistics and Playback Reporting plugins, disabled DLNA and restarted the server but the file still had the audio distortion when played from Emby. It took a bit of time to figure out how to extract the streams and copy them to a new mp4 whilst retaining the Dolby Vision but I eventually managed to do it with mp4demuxer (https://github.com/DolbyLaboratories/dlb_mp4demux) and mp4muxer (https://github.com/DolbyLaboratories/dlb_mp4base).
I haven't found a way to include the subs in the new mp4 again but the file seems to play without issues now.


Must have been something really strange with the original file as it only had the distortion when played via the Emby app.
Thanks for all the input everyone!

  • Like 1
Link to comment
Share on other sites

rbjtech

Nice - well done. 👍

Post removing those plugins - It would be interesting to see if your system is no longer being hammered every couple of seconds - if you are ok with it - can you post another log playing the same content (with the non remux'd file) - you may have deleted the file  .. 🤪 

 

Link to comment
Share on other sites

  • 1 month later...
Ceten
On 4/23/2021 at 5:43 PM, rbjtech said:

Nice - well done. 👍

Post removing those plugins - It would be interesting to see if your system is no longer being hammered every couple of seconds - if you are ok with it - can you post another log playing the same content (with the non remux'd file) - you may have deleted the file  .. 🤪 

 

Hi sorry for the long delay, I've been busy with work and studying the past month, I didn't even get to actually finish this first episode of the falcon and the winter soldier🤪 I no longer have the original file but I remember looking into it at the time and I think this was coming from the Playback Reporting plugin but didn't occur again when testing the original file after your reply (and before removing the plugin) so I'm guessing it might have been caused by repeatedly starting and stopping the same episode to test it.

Link to comment
Share on other sites

  • 2 weeks later...
On 5/25/2021 at 5:23 AM, Ceten said:

Hi sorry for the long delay, I've been busy with work and studying the past month, I didn't even get to actually finish this first episode of the falcon and the winter soldier🤪 I no longer have the original file but I remember looking into it at the time and I think this was coming from the Playback Reporting plugin but didn't occur again when testing the original file after your reply (and before removing the plugin) so I'm guessing it might have been caused by repeatedly starting and stopping the same episode to test it.

So you haven't' seen it with any other files?

Link to comment
Share on other sites

Ceten

I just went through all logfiles on the server and found only 1 occurence in the log for yesterday evening. After rechecking I'm not sure it's related to the PlaybackReporting plugin?
I think that plugin only uses the PlaybackActivity table?

embyserver-63758793600.txt

Link to comment
Share on other sites

On 6/9/2021 at 10:31 AM, Ceten said:

I just went through all logfiles on the server and found only 1 occurence in the log for yesterday evening. After rechecking I'm not sure it's related to the PlaybackReporting plugin?
I think that plugin only uses the PlaybackActivity table?

embyserver-63758793600.txt 1.57 MB · 0 downloads

Hi @Ceten, for starters I would update to 4.6.2, and then I would reenable all of the options that you disabled in the first post. Please let us know if this helps. Thanks.

Link to comment
Share on other sites

  • 8 months later...
Ceten

Hi I hate to bring this up again but I'm having this issue with a lot of files now. The thing they have in common is that they are mp4 files with Dolby Vision, Version 1.0, dvhe.05.06, BL+RPU video and Dolby Digital Plus with Dolby Atmos audio and often a lot of subs.
The audio distortion occurs both when playing over dlna or in the Emby LG app, but not when played from a usb stick using the internal player of the tv.

I also tried connecting the tv to the network with an UTP cable to make sure the connection was stable but that didn't make a difference for these files.
I then tried a high bitrate mkv remux of The Fellowship of The Ring to make sure the network wasn't a problem and that played fine over wifi (buffering over ethernet due to the 100mbps port so I'll keep using wifi).
When playing the mp4 files my Synology showed an upload of around 2-3 MBps, while the Lord of The Rings movie was 11-14 MBps.

The files are direct playing from a share on my Synology DS918. I noticed the protocol is http so it seems they are wrapped and not read directly read from the share. Is this something that might have an impact or that I can alter to test if it does?
Attached are a video of the issue, media info for 2 files that have the audio distortion issue and the server log.
You can ignore the part in the log where I tried to play the first episode of Falcon and the Winter Soldier. Apparantly this was a Dolby Vision mkv which i had added to see if it could be an alternative to the Dolby Vision mp4 files, but the tv does not support them so the colours are all wrong.

The Witcher S02E01 Media Info.txt embyserver20220311.txt Loki S01E01 Media Info.txt

Link to comment
Share on other sites

SamES
1 hour ago, Ceten said:

I then tried a high bitrate mkv remux of The Fellowship of The Ring to make sure the network wasn't a problem and that played fine over wifi (buffering over ethernet due to the 100mbps port so I'll keep using wifi).
When playing the mp4 files my Synology showed an upload of around 2-3 MBps, while the Lord of The Rings movie was 11-14 MBps.

 

Unless your files are exceeding 50Mb/sec then network speed shouldn't be an issue.

So if I understand this correctly, you are suggesting that the problem is somehow related to mp4 (as mkv) works fine.

It is also a possibility that the number of subs is causing a problem.

@rbjtech, can please help ceten with an ffmpeg command to copy the video, audio and maybe the first two sub-tracks to a new mp4 container?  This should help rule that out as an issue.  Thanks

Link to comment
Share on other sites

rbjtech

Hi @SamES - I certainly can but I don't believe this will fix the issue because the LG App does not support DV via MKV (this may be incorrect and has been fixed with a later WebOS version - I no longer use the LG Client at all ..)

There is a couple of things to try / eliminate.

I notice it was only the audio that has the issue (while streaming, direct USB is ok) - so can you try a remux using AC3 as opposed to EAC3 ?

ffmpeg -i <input file.mp4> -map 0:v -map 0:a:0 -map 0:a -c:v copy -c:a copy -c:a:0 ac3  -disposition:a:0 default -disposition:a:1 0 -metadata:s:a:0 title="New AC3 Track" -metadata:s:a:1 title="Original EAC3 Track" <output file.mp4>

The above simply takes the input file, adds an AC3 track created from the EAC3 track and makes it the Default 1st Audio track.

When playing the new file, if Audio plays OK - then we know it has something to do with the EAC3/DV combination in the Emby implementation of the LG player.

It's also worth trying EAC3 with the remuxed file as well - as this 'may' then work as it has been remuxed vs the original file.

I have an LG TV C7 as well, so I can try this out a bit later on today or maybe over the weekend..

Edited by rbjtech
  • Thanks 1
Link to comment
Share on other sites

SamES
56 minutes ago, rbjtech said:

Hi @SamES - I certainly can but I don't believe this will fix the issue because the LG App does not support DV via MKV (this may be incorrect and has been fixed with a later WebOS version - I no longer use the LG Client at all ..)

Thanks, actually I was wanting to stick with an mp4 container (not mkv).  I'm curious if we just copy the video, audio and 1 or 2 sub tracks to a new mp4 does this resolve the issue?

Your suggestion of an AC3 tracks is also a good one.  I know on Samsung we have issues with playback once we have too many sub tracks, but I can't recall if this has caused problems in the past with LG.  Ideally I'd like to eliminate the subs tracks from the equation.

 

Link to comment
Share on other sites

rbjtech
11 minutes ago, SamES said:

Thanks, actually I was wanting to stick with an mp4 container (not mkv).  I'm curious if we just copy the video, audio and 1 or 2 sub tracks to a new mp4 does this resolve the issue?

 

ah right with you.

Let me have a play today ...

  • Like 1
Link to comment
Share on other sites

Ceten

Hi @rbjtech and @SamES, I just tried the ffmpeg command and the remuxed file plays the AC3 and EAC3 tracks without distortion but now the colours are off as it is no longer recognised as Dolby Vision (the new file also has no subs any more).
I was thinking about the subs being a problem too but then I remembered looking at other series which were mp4 with Dolby Vision and EAC3 atmos without noticing any distortion.
I've attached the media info for such an episode with 43 subs.

Acapulco S01E01 Media Info.txt

  • Thanks 1
Link to comment
Share on other sites

rbjtech
38 minutes ago, Ceten said:

Hi @rbjtech and @SamES, I just tried the ffmpeg command and the remuxed file plays the AC3 and EAC3 tracks without distortion but now the colours are off as it is no longer recognised as Dolby Vision (the new file also has no subs any more).
I was thinking about the subs being a problem too but then I remembered looking at other series which were mp4 with Dolby Vision and EAC3 atmos without noticing any distortion.
I've attached the media info for such an episode with 43 subs.

Acapulco S01E01 Media Info.txt 31.52 kB · 0 downloads

ok - so no subs is known as I didn't include the syntax to copy them (just add -map 0:s:0 -c:s copy) to copy sub track 0 (the first one).

So yes, this is where DV and MP4's start to get complicated and where I much prefer MKV (and why I dumped the LG Player and moved to the Android Shield!).

There are certain things you need to do to the MP4's to retain the DV encoding - I *think* a standard remux removes this layer (ffmpeg ignores it during the stream copy).

Let me have a play today and I'll see what I can find out on the MP4 side of things.

@FrostByte might have looked into this also and can probably advise a solution to remux the MP4 and retain DV.

  • Thanks 1
Link to comment
Share on other sites

rbjtech
14 minutes ago, FrostByte said:

I haven't used mp4 myself since I got the Shield. 

When I was using mp4 I always had a problem with ffmpeg muxing the DV metadata in a mp4 container so I had to use mp4muxer.  

dlb_mp4base/bin at master · DolbyLaboratories/dlb_mp4base (github.com)

 

Nice ! - Thanks @FrostByte - this seems to be exactly what is needed -

Quote

Usage: mp4muxer arg [options]

 Args:       [Options]              Descriptions:
 -----       --------------------   -------------------------------------------------------
 --help,-h                          = Shows the help information.
 --version,-v                       = Shows the version information.
 --input-file,-i <file.ext> [--media-lang <language>]
                            [--media-timescale <timescale>]
                            [--input-video-frame-rate <framerate>]
                                    = Adds elementary stream (ES) file.ext with
                                      media language, timescale, and framerate(only for video,such as 23.97 or 30000/1001).
                                      Supports H264, H265, AC3, EC3, and AC4.
 --output-file, -o <file.mp4>       = Sets the output file name.
 --overwrite                        = Overwrites the existing output .mp4 file if there is one.
 --mpeg4-timescale <arg>            = Overrides the timescale of the entire presentation.
 --mpeg4-brand <arg>                = Specifies the ISO base media file format brand in the format.
 --mpeg4-comp-brand <arg>           = Specifies the ISO base media file format compatible brand(s),
                                      in the format of a comma separated list, for example mp42,iso6,isom,msdh,dby1.
 --output-format <arg>              = Sets the output file format or the specification to which the
                                      output file must conform. Valid values include 'mp4' and 'frag-mp4'.
                                      'mp4' is the default value.
 --mpeg4-max-frag-duration <arg>    = Sets the maximum fragment duration in milliseconds.
                                      By default, the max duration is 2s.
 --dv-profile <arg>                 = Sets the Dolby Vision profile. This option is MANDATORY for
                                      DoVi elementary stream: Valid profile values are:
                                      4 - dvhe.04, BL codec: HEVC10; EL codec: HEVC10; BL compatibility: SDR/HDR.
                                      5 - dvhe.05, BL codec: HEVC10; EL codec: N/A;    BL compatibility: None.
                                      7 - dvhe.07, BL codec: HEVC10; EL codec: HEVC10; BL compatibility: Blue-ray HDR10.
                                      8 - dvhe.08, BL codec: HEVC10; EL codec: N/A;    BL compatibility: SDR/HDR.
                                      9 - dvav.09, BL codec: AVC;    EL codec: N/A;    BL compatibility: SDR/HDR.
 --dv-bl-compatible-id <arg>        = Sets the Dolby Vision base layer compatible ID, if the profile index is 8, this option must be set by user.
 --dvh1flag                         = Set the elementray stream index to set HEVC track's sample entry name to 'dvh1',
                                      default sample entry box name is 'dvhe' for non-cross compatible stream.
 --hvc1flag                         = Set the elementray stream index to set HEVC track's sample entry name to 'hvc1',
                                      default sample entry box name is 'hev1' for cross compatible stream.


mp4muxer usage examples:
---------------------------------------------------
To create an audio-only .mp4 file with EC-3 audio:
   mp4muxer -o output.mp4 -i audio.ec3 --mpeg4-comp-brand mp42,iso6,isom,msdh,dby1

To multiplex AC-4 audio and H.264 video:
   mp4muxer -o output.mp4 -i audio.ac4 -i video.h264 --mpeg4-comp-brand mp42,iso6,isom,msdh,dby1

To multiplex Dolby vision BL+EL+RPU into a .mp4 file :
   mp4muxer -i ves_bl_el_rpu.264 -o single_track_output.mp4 --dv-profile 0 --mpeg4-comp-brand mp42,iso6,isom,msdh,dby1 --overwrite

To multiplex Dolby vision BL+EL+RPU file into a .mp4 file with EC-3 audio track:
   mp4muxer -i ves_bl_el_rpu.265 -i audio.ec3 -o output.mp4 --dv-profile 8
            --dv-bl-compatible-id 2 --mpeg4-comp-brand mp42,iso6,isom,msdh,dby1 --overwrite
   Note: For the Dolby vision profile 8, dv-bl-compatible-id is necessary.

To multiplex Dolby vision profile 8.4 file into a .mp4 file with sample entry name as 'hvc1':
   mp4muxer -i ves_8.4.265 -o output.mp4 --hvc1flag 0 --dv-profile 8
            --dv-bl-compatible-id 4 --mpeg4-comp-brand mp42,iso6,isom,msdh,dby1 --overwrite
   Note: For the Dolby vision profile 8, dv-bl-compatible-id is necessary.

 

  • Like 1
Link to comment
Share on other sites

rbjtech

So I had a play today - and in summary, I can't appear to re-create the problem.

I used a different file (but from the same scene-DVSUX) - so that may be the issue but I successfully -

1) Played back the original file on the LG Client using the LG Internal Speakers no issues - DV and Atmos triggered and played fine.  NO SUBS - this forces a transcode. (subs were 'timed text - tx3g Codec ID in mediaInfo)

2) Demuxed the mp4 using mp4demuxer - into .265 and .ec3 - subs were saved with .DAT (?) 

3) Remuxed the video and audio components above into a new .mp4 using mp4muxer - set DV profile as 5 (same as original) - no subs.

4) This new file played back just fine as well - triggering DV and Atmos.

So - you can try doing the demux/remux to see if that fixes the issue (but you'll lose subs as I couldn't find a way to embed these - external .srt subs didn't appear to work either :( )

If you can upload the original file to dropbox or something (or pm me the magnet link) then I'm happy to try with that, but its looking like the file in it's original mux may not be compatible with the Emby wrapper of the LG Client ...

 

 

Edited by rbjtech
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

SamES
1 hour ago, rbjtech said:

I used a different file (but from the same scene-DVSUX) - so that may be the issue but I successfully -

Thanks for testing this out.  How many internal sub streams did your sample have?

Link to comment
Share on other sites

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...