jellyfin / jellyfin-androidtv

Android TV Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.67k stars 457 forks source link

v0.13.x Regression - Direct Play of MPEGTS Streams in Progress #1623

Closed MovieWiz closed 1 year ago

MovieWiz commented 2 years ago

Describe the bug

I use NextPVR to record OTA tv directly into my Jellyfin tv show library.

With V0.12.3 on my Firesticks (one is a 2020 Lite connected to AV receiver and other is FireStick 4K), I could direct play (using exoplayer) recorded tv (in .ts files) -- including both shows still being recorded and shows that completed recording.

With v0.13.x, I can direct play shows that have completed recording but not shows that are still being recorded. When I try to direct play a show in progress (i.e. timeshifting -- I start watching maybe 20 minutes after an hour show started recording), there is a very long delay before playback starts (maybe 2 or 3 minutes), if it starts at all. Playback began immediately with 0.12.3.

I like to direct play everything since my firesticks can direct play all the video and sound formats that I use. As I think you know about already, the exoplayer client/server negotiation often results in transcoding on files that can be direct played. To get around that, I disabled the following 3 settings for my userid on the server

This forces direct play which has been working fabulously for me. With the v0.13.x app series though, allowing transcoding for the video is the only thing that works for in progress recordings. Playback begins fairly promptly for in progress recordings but, of course, skipping back/forward with transcoding is much slower compared to direct play.

Since the .ts files direct play fine after recording has finished, it seems that that there is a issue with the file still being open and size growing which is confusing the server or client. Maybe v.0.13.x has some sort of new server to client notification when the size of the file changes which is firing very often. Doesn't seem to be container problem because the ts files direct play fine after recording has completed.

Anyway, sorry for the long winded explanation. It's complicated to explain but a really easy problem to recreate and it happens consistently.

Jellyfin is just a wonderful thing that's been made available to us. The reliability is just amazing. It just works.

Logs

No response

Application version

0.13.x

Where did you install the app from?

Sideloaded APK

Device information

Firesticks - 2020 Lite and 4K

Android version

Fire OS 7 on Lite and 6 on 4K

Jellyfin server version

10.7.7 (Windows)

MovieWiz commented 2 years ago

Note that I am not using the Live TV features within Jellyfin. I have a Hauppauge QuadHD tuner and I use NextPVR (directly) to record into a Jellyfin library folder. It's the only way I've found to be able to timeshift effectively. The only oddity with this approach is that the player will get the length of video when I start playback. Since it is still growing, playback can "finish" prematurely. I get around that my stopping and restarting periodically, usually at the beginning of every commercial -- this refreshes the video length for the player.

May not be the way anyone intended that the two products be used together -- but it sure works well.

So I know I'm being a tad greedy when I mention the inability to direct play now. I love the product though, and if this report helps to improve it even more, great!!

MovieWiz commented 2 years ago

Further info. I uninstalled the NextPVR plugin just in case it was causing some weird communication loop between client/server. But that made no difference.

The delay for playback to begin seems to increase the longer the show has been recording. When I attempted playback shortly after recording started, the delay was about 10 seconds. When I attempted playback 20 minutes after the recording started, it was 1:14 before playback started. Again, with v0.12.3, direct playback was basically instant.

If there are any options that you want me to vary and try, let me know.

mueslimak3r commented 2 years ago

In 0.13, with transcoding disabled, what kind of error do you get when you attempt to play a recording-in-progress video? Or with transcoding enabled, what is the "transcoding reason" listed in the dashboard?

MovieWiz commented 2 years ago

With all transcoding/remuxing options disabled, the video will direct play but, like I said, there will be a 1 to 3 minute delay before playback begins where playback would begin immediately with v0.12.3. So there is no error reported.

With the transcoding options enabled, the transcoding reasons are video codec not supported, audio codec not supported and container not supported. But this is not unique to in progress recordings. It happens will all recorded television on the fire sticks. I thought that was a well known issue -- the app pretty much wants to transcode everything. That's why I disabled the transcoding options because my firesticks can play direct all formats that I use (except one series from 20 years ago in a less common formats).

The new issue that I'm reporting here is just the playback for issue for .ts files that are still growing due to recording still being in progress. With v0.12.3 direct play begins immediately and with v0.13.0, there's a long pause first which seems to get longer and longer based on how long the file has been recording. There's something new happening in v0.13.x that is causing playback to be delayed -- maybe v0.13.x is subscribing to some sort of event from the server (like media changes) that's causing some sort of cycling issue that takes time to resolve.

It should be pretty easy to make happen. Use whatever OTA DVR software you might have to record a show into the jellyfin library. After about 20 minutes, start playback with all the transcoding options disabled for the userid on the server.

It maybe relevant that I have the server configured to automatically detect new/updated files.

mueslimak3r commented 2 years ago

Can you record some logs of this issue happening using adb logcat? If you can, upload them to pastebin and make sure to remove all sensitive info.

And please include a brief summary of what you're doing in the app while recording the logs. Eg: 1) start recording 2) try direct playing and it takes a while to start 3) try playing with the media transcoded

MovieWiz commented 2 years ago

Sorry, it's not really practical with FireSticks. The usb is used for power and it's just not practical for me with my desktop computer and single monitor. So I don't think I can be involved further. I'm just a user that is trying to be helpful. But I'm not looking to install a bunch of tools on my pc.

But I hope the report can still be helpful. Hopefully someone on the team has a firestick and tv tuner that they can use to recreate the problem.

Fyb3roptik commented 2 years ago

Im wondering if this is my issue currently. I have a friend who tried to use Firestick Jellyfin to watch my live tv. He was unable to get it to play, it would only error. Using mobile app and casting it worked fine as did Roku

thornbill commented 2 years ago

You are able to connect over wifi to use adb. It does not require a physical usb connection.

Fyb3roptik commented 2 years ago

I just got my firestick in today. Will get you logs. I see it happening on mine too

Fyb3roptik commented 2 years ago
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal: Playback error
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:   com.google.android.exoplayer2.ExoPlaybackException: Source error
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:628)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:598)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:102)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:193)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:65)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:   Caused by: com.google.android.exoplayer2.ParserException: Missing CodecPrivate for codec A_AAC
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$Track.getCodecPrivate(MatroskaExtractor.java:2460)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$Track.initializeOutput(MatroskaExtractor.java:2045)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor.endMasterElement(MatroskaExtractor.java:770)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor$InnerEbmlProcessor.endMasterElement(MatroskaExtractor.java:1879)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.extractor.mkv.DefaultEbmlReader.read(DefaultEbmlReader.java:84)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor.read(MatroskaExtractor.java:480)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1046)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-05 13:53:01.508 17783 18461 E ExoPlayerImplInternal:       at java.lang.Thread.run(Thread.java:764)
05-05 13:53:01.511 17783 17783 E VideoManager: ***** Got error from player
05-05 13:53:01.534 17783 17783 I PlaybackController: Player error encountered - retrying
05-05 13:53:01.534 17783 17783 D PlaybackController: stop called at 3181534
mueslimak3r commented 2 years ago

I just got my firestick in today. Will get you logs. I see it happening on mine too

The partial log you you posted is helpful. However, to properly evaluate it the full log will be the most useful. Can you remove your sensitive info from it and post it here as a file. Please upload it as a file instead of just pasting the text into a comment

Fyb3roptik commented 2 years ago

logcat.txt

Fyb3roptik commented 2 years ago

Using VLC player fixes this issue, so looks like an issue with Exoplayer

Fyb3roptik commented 2 years ago

@mueslimak3r Just making sure you saw this :)

mueslimak3r commented 2 years ago

Yup 🙂 I'll probably have time to look through the log and the relevant code some time this weekend. Perhaps later today or tomorrow

MovieWiz commented 2 years ago

Just want to confirm that the issue is still happening in v0.13.7. When I attempt direct playback of a .ts file OTA recording (with MPEG2 and AC3) in progress (using exoplayer), there is a long pause (i.e. minutes) before playback starts. Playback starts immediately if I do either of the following:

a) enable transcoding of the video (not necessary to enable audio transcoding)

or

b) Wait for the recording to finish so that the file is no longer growing.

The issue does not happen in v0.12.3.

Still using the 10.7.7 server as I have a number of issues with playback on FireSticks with the 10.8.1 server. Clearly, the issue is related to the fact that the ts file is still growing.

jellyfin-bot commented 1 year ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.