Jump to content

Choppy/Studdering playback on some HEVC files


ruest
Go to solution Solved by ruest,

Recommended Posts

ruest

Having a problem with playback on some 1080p HVEC mp4 video files, these are all Direct Play with no transcoding or remuxing.   I have narrowed it down to the Emby Android app and tested the problem on Samsung Galaxy Tab S7, Samsung Note 10+, Unihertz Atom XL )

 

They play fine on these:

1) Emby Samsung App

2) Emby iOS App

3) Emby Theater on Windows 10

4) Android native Video Player

 

They have problems on 

5) Emby Android App - has choppy video

6) Web browser interface on Android browsers - has severe studdering and indicates dropped frames.

 

Emby Server is fine an I have Issolated the Problem to the Android Client by testing and seeing the same playback problems with these videos (2mbps video stream) over:

a) n wifi

b) ac wifi

c) wired ethernet via usb-c dongle

d) downloaded via client (original file/quality) then played downloaded file via client with all network connections disabled.

 

Finally Playing the client downloaded video file through the native Android video player plays back perfectly with No issues.

 

 

I checked the Android App data location and it does not have any client log directory or logs that I can find. 

If someone from Emby Support can direct message me I can provide a remote login details to my server so you can try the playback an/or download the failing videos to test as needed.

Link to comment
Share on other sites

ruest

The server version is 4.8.1.0 on running on Win 7
The playback issue is consistant through the entire video regardless of being streamed or downloaded and  played locally with no server involvement.

Emby for Android client versions tested
3.3.66
3.2.50

The client is not producing any errors or a log, just choppy (not smooth) video.

I have included screenshots of the video details and stats for streaming and local playback

If needed I can run a test tonight and grab a log on the server

I will PM you the server connection details.  There is a "Bad Playback" library with 3 movies demonstrating this issue and a "Good Playback" library with 1 movie showing the same info for video details/encoding but that plays fine.

Screenshot_20240215_213829_Emby.jpg

Screenshot_20240216_143225_Emby.jpg

Screenshot_20240216_143144_Emby.jpg

Link to comment
Share on other sites

ruest

For this test I rebooted the Server and played  the video for a few minutes from my unihertz Atom_L  runnning Android 11

Emby Android app 3.3.66

embyserver.txt

Screenshot_20240218_172801_Emby.thumb.jpg.3414b16e56493ef7fdbd7b0d209685a1.jpg

Link to comment
Share on other sites

ruest

Sure thing Luke,

If you check your Private Messsages, last Friday I sent you a message titled:

Serve connection details for testing - Android App Choppy/Studdering

It has server connection and library/video details, 3 videos demonstrating the problem and 1 with the same encoding that does not have the problem.

The account is setup for playback and download.

  • Thanks 1
Link to comment
Share on other sites

Kusano

Hey,

i have exactly the same problem.

Fire TV with the app from amazon or sideloaded android apk play some HEVC files only with heavy stuttering/freeze frames.

in my case i found the reason but i still don't know why it is like that (keeps me from changing to emby for a week now)

If the HEVC file is format profile: Main@L6.2@High it will direct play with no log errors but will stutter like hell.

if i only change the metadata from Main@L6.2@High to Main@L1.4@High via a quick

ffmpeg -i INPUT.mkv -map 0 -c copy -bsf:v hevc_metadata=level=41 OUTPUT.mkv

the new file plays flawlessly.

stuttering video:

Format                                   : Matroska
Format version                           : Version 4
File size                                : 2.02 GiB
Duration                                 : 23 min 35 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 12.3 Mb/s
Frame rate                               : 23.976 FPS
Encoded date                             : 2020-12-28 05:33:09 UTC
Writing application                      : mkvmerge v51.0.0 ('I Wish') 64-bit
Writing library                          : libebml v1.4.0 + libmatroska v1.6.2

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L6.2@High
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 23 min 35 s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Language                                 : Japanese
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : DTS XLL
Format/Info                              : Digital Theater Systems
Commercial name                          : DTS-HD Master Audio
Codec ID                                 : A_DTS
Duration                                 : 23 min 35 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossless
Language                                 : German
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : DTS XLL
Format/Info                              : Digital Theater Systems
Commercial name                          : DTS-HD Master Audio
Codec ID                                 : A_DTS
Duration                                 : 23 min 35 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossless
Language                                 : Japanese
Default                                  : No
Forced                                   : No

Text
ID                                       : 4
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Language                                 : German
Default                                  : No
Forced                                   : No

Menu
00:00:00.000                             : en:Chapter 01
00:00:22.439                             : en:Chapter 02
00:01:52.070                             : en:Chapter 03
00:10:47.938                             : en:Chapter 04
00:21:57.899                             : en:Chapter 05
00:23:28.031                             : en:Chapter 06

i would rather not change every file to fix this because they work in plex (windows/android) and in windows 11 emby theater 😕

Link to comment
Share on other sites

  • 3 weeks later...
ruest

Yes @Lukestill have issues.

I also tested Emby on a Roku Ultra and found it has the same playback issue as Android but they still play fine on Emby Samsung, iOS, and Emby Theater.

I have seen this issue called out on other platforms as well with various suggestions for modifying the video files but have not had time to go through those to try to get to the root cause.

I assume it will be something in the video encoding that is not playing well with the libraries Emby is using on some platforms vs others if there is anything specific that could help in addition to the access to the source files that have been provided just let me know. 

Overall i would like to get to an understanding of the root cause as it would be more beneficial to the Emby Platform as a whole if there is a solution where the Android and Roku playback engines could handle the issue like it does on the other Emby clients vs needing each user to modify or re-encode every source file they come across with the problem. 

 

Plays fine on these:

1) Emby Samsung App

2) Emby iOS App

3) Emby Theater on Windows 10

4) Android native Video Player

5) Web browser on Samsung TV

 

Has problems on these:

5) Emby Android App - has choppy video

6) Web browser interface on Android browsers - has severe studdering and indicates dropped frames.

7) Emby Roku App - has choppy video

 

Link to comment
Share on other sites

13 hours ago, ruest said:

Yes @Lukestill have issues.

I also tested Emby on a Roku Ultra and found it has the same playback issue as Android but they still play fine on Emby Samsung, iOS, and Emby Theater.

I have seen this issue called out on other platforms as well with various suggestions for modifying the video files but have not had time to go through those to try to get to the root cause.

I assume it will be something in the video encoding that is not playing well with the libraries Emby is using on some platforms vs others if there is anything specific that could help in addition to the access to the source files that have been provided just let me know. 

Overall i would like to get to an understanding of the root cause as it would be more beneficial to the Emby Platform as a whole if there is a solution where the Android and Roku playback engines could handle the issue like it does on the other Emby clients vs needing each user to modify or re-encode every source file they come across with the problem. 

 

Plays fine on these:

1) Emby Samsung App

2) Emby iOS App

3) Emby Theater on Windows 10

4) Android native Video Player

5) Web browser on Samsung TV

 

Has problems on these:

5) Emby Android App - has choppy video

6) Web browser interface on Android browsers - has severe studdering and indicates dropped frames.

7) Emby Roku App - has choppy video

 

And it's direct playing each time?

Link to comment
Share on other sites

ruest

 

14 hours ago, Luke said:

And it's direct playing each time?

Yes, All scenarios are direct play.

Link to comment
Share on other sites

RanmaCanada

I would suggest you use mediainfo as the other user has, to post the actual information about the file, as Emby doesn't get anywhere near the details required to troubleshoot something like this.

Link to comment
Share on other sites

Morshu

Sounds a lot like the issue I'm having. 4k HEVC files, when starting then they stutter and video choppieness never recovers. HDR is broken too, like the signal to the TV to switch to HDR isn't sent. It's not all files though. And it's only happening on my Nvidia shield, plays fine on Android mobile app. 

They play fine on Plex (sorry if this is irrelevant), so this seems to be an isolated issue for certain files. 

Link to comment
Share on other sites

  • Solution
ruest

@Luke I have found what I believe is causing the playback issue in the files I have. 

I would ask that you take a look at the cause and see if you can determine why some Emby clients can automatically handle this problem in the video source and some cannot. 

Ultimately the goal would be to have all Emby clients being able to detect and automatically handle this non-fatal encoding problem.

 

Root Cause

Research led me to several old issues potential related to timestamp induced jitters.  The one that turned out to be my issue was the MP4 file not containing a ctts atom (frame offset table) which induced the jitter with constant out of order frames.

 

The bottom of this thread contains the technical description of the problem  

https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2777

and a link to the detection and correction code added to  mkvmerge  to fix this issue during remuxing.

https://gitlab.com/mbunkus/mkvtoolnix/-/commit/1813e97cbf8f3691c55207f6c72d046ec00a2381

 

In testing I confirmed that remuxing mp4 to mkv with   ffmpeg  does Not correct the problem, but remuxing with mkvmerge Does correct it.

 

  • Like 1
Link to comment
Share on other sites

On 3/17/2024 at 10:23 PM, ruest said:

@Luke I have found what I believe is causing the playback issue in the files I have. 

I would ask that you take a look at the cause and see if you can determine why some Emby clients can automatically handle this problem in the video source and some cannot. 

Ultimately the goal would be to have all Emby clients being able to detect and automatically handle this non-fatal encoding problem.

 

Root Cause

Research led me to several old issues potential related to timestamp induced jitters.  The one that turned out to be my issue was the MP4 file not containing a ctts atom (frame offset table) which induced the jitter with constant out of order frames.

 

The bottom of this thread contains the technical description of the problem  

https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2777

and a link to the detection and correction code added to  mkvmerge  to fix this issue during remuxing.

https://gitlab.com/mbunkus/mkvtoolnix/-/commit/1813e97cbf8f3691c55207f6c72d046ec00a2381

 

In testing I confirmed that remuxing mp4 to mkv with   ffmpeg  does Not correct the problem, but remuxing with mkvmerge Does correct it.

 

Hi, the problem is with the web app and the Roku app, we are dependent on the web browser video player and the Roku system video player.

For those players to be able to automatically handle this,, the improvements need to happen at that level, not in the Emby user interface. What Emby could do is force transcoding on everything in order to correct the problem, but obviously that's not a desirable solution.

Maybe you could report the problem in the Roku forums? Anyhow, thanks for the investigation.

Link to comment
Share on other sites

ruest

Thanks for the explanation.  I agree that forcing transcoding is not a good option and fixing the bad encodes would be better.

I'll followup with Roku and see what they say.  In the meantime at least now I can now fix my own library as I run across files with this issue.

Link to comment
Share on other sites

2 minutes ago, ruest said:

Thanks for the explanation.  I agree that forcing transcoding is not a good option and fixing the bad encodes would be better.

I'll followup with Roku and see what they say.  In the meantime at least now I can now fix my own library as I run across files with this issue.

Android is the one platform where we work hands on with the video player and have more control over it, so yes in theory this could be handled and recovered from.

However these are not always easy to solve and require a lot of developer time to rework the way things are happening with the decoders, renderers, etc. Users constantly throw all kinds of wrinkles at us with oddly encoded files, however we get so many of them that we have to pick our battles. Generally speaking, if we think the issue that you're running into could be applicable for other users, then we'll be more likely to want to build some resiliency into the video player for it.

Link to comment
Share on other sites

ruest
On 3/19/2024 at 1:52 AM, Luke said:

however we get so many of them that we have to pick our battles. Generally speaking, if we think the issue that you're running into could be applicable for other users, then we'll be more likely to want to build some resiliency into the video player for it.

I understand completely, and thank you for the assistance and support.

I have also reported the problem to Roku referencing my tests with direct USB playback using the Roku player and will update here if/when they provide a response.

  • Thanks 1
Link to comment
Share on other sites

ScottyT
On 18/03/2024 at 15:23, ruest said:

@Luke 

In testing I confirmed that remuxing mp4 to mkv with   ffmpeg  does Not correct the problem, but remuxing with mkvmerge Does correct it.

 

Thanks, this helped me with my problem too. I have a large number of 'consumer' HEVC movie files (RARBG, LAMA) that show these timing issues on both the Android TV app and the Android app on my TCL TV. The problem files play ok in other apps, but then I don't get the Android TV app's option to convert "unknown audio" multichannel AAC to AC3 5.1 so only get stereo sound.

Remuxing with mkvmerge fixes the playback issue, I just now have to batch convert hundreds of probable problem files. It would be great if Emby could work around whatever the issue is to allow smooth playback. I can provide multiple samples if needed.

Thanks all.

  • Thanks 1
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...