jellyfin / jellyfin-android

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

Integrated player & External player won't play mp4 h264 acc media #850

Closed rangeroob closed 1 year ago

rangeroob commented 1 year ago

Describe the bug

1) Go to client settings 2) Select Integrated Player or External Player 3) Attempt to play media in mp4 format (h264 & acc)

I get this Error:

Unable to load media info from server

I re-encoded into mkv format with h264 & acc and it plays. I am not getting any errors within the logs of why it's failing.

Just know that the media in mp4 format played fine before and now it is not.

Logs

2022-10-18 19:02:53.252 -04:00] [INF] User policy for "jellyfin". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2022-10-18 19:02:53.258 -04:00] [INF] StreamBuilder.BuildVideoItem( Profile="Jellyfin Android", Path="/media/backupSGHD1/Anime/Michiko and Hatchin/Season One/Michiko & Hatchin - 1x01 - Farewell, Cruel Paradise!.mkv", AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) "media:/videos/20f45eab-dcac-5e6d-a46f-97adbc80618b/stream.mkv?MediaSourceId=20f45eabdcac5e6da46f97adbc80618b&Static=true&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=2&api_key=<token>&Tag=9362db70c934f1fd7d0178a812160aaa"
[2022-10-18 19:02:54.366 -04:00] [INF] Adding playback tracker : 5f888e9cb24a8aa4f1ac20cf2eb342c7b58b660469951612-f1ac20cf2eb342c7b58b660469951612-20f45eabdcac5e6da46f97adbc80618b
[2022-10-18 19:02:54.368 -04:00] [INF] PlaybackTracker : Adding Start Event : 10/18/2022 19:02:54
[2022-10-18 19:02:54.370 -04:00] [INF] Creating StartPlaybackTimer Task
[2022-10-18 19:02:54.371 -04:00] [INF] StartPlaybackTimer : Entered
[2022-10-18 19:02:54.432 -04:00] [INF] Processing playback tracker : "5f888e9cb24a8aa4f1ac20cf2eb342c7b58b660469951612-f1ac20cf2eb342c7b58b660469951612-20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:02:54.889 -04:00] [WRN] Slow HTTP Response from "https://jellyfin.dmviera.pw/Sessions/Playing/Progress" to "10.0.30.61" in 0:00:01.5129972 with Status Code 204
[2022-10-18 19:03:14.376 -04:00] [INF] session.RemoteEndPoint : "10.0.30.61"
[2022-10-18 19:03:14.381 -04:00] [INF] StartPlaybackTimer : event_playing_id     = "20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:03:14.384 -04:00] [INF] StartPlaybackTimer : event_user_id        = "f1ac20cf2eb342c7b58b660469951612"
[2022-10-18 19:03:14.384 -04:00] [INF] StartPlaybackTimer : event_user_id_int    = 1
[2022-10-18 19:03:14.384 -04:00] [INF] StartPlaybackTimer : session_playing_id   = "20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:03:14.385 -04:00] [INF] StartPlaybackTimer : session_user_id      = "f1ac20cf2eb342c7b58b660469951612"
[2022-10-18 19:03:14.385 -04:00] [INF] StartPlaybackTimer : play_method          = "DirectPlay"
[2022-10-18 19:03:14.385 -04:00] [INF] StartPlaybackTimer : e.ClientName         = "Jellyfin Android"
[2022-10-18 19:03:14.385 -04:00] [INF] StartPlaybackTimer : e.DeviceName         = "Derek's A13"
[2022-10-18 19:03:14.386 -04:00] [INF] StartPlaybackTimer : ItemName             = "Michiko & Hatchin - s00e01 - Farewell, Cruel Paradise!"
[2022-10-18 19:03:14.386 -04:00] [INF] StartPlaybackTimer : ItemId               = "20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:03:14.386 -04:00] [INF] StartPlaybackTimer : ItemType             = "Episode"
[2022-10-18 19:03:14.386 -04:00] [INF] StartPlaybackTimer : All matches, playback registered
[2022-10-18 19:03:14.387 -04:00] [INF] Playback tracker found, adding playback info : "5f888e9cb24a8aa4f1ac20cf2eb342c7b58b660469951612-f1ac20cf2eb342c7b58b660469951612-20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:03:14.387 -04:00] [INF] Saving playback tracking activity in DB
[2022-10-18 19:03:14.629 -04:00] [INF] Processing playback tracker : "5f888e9cb24a8aa4f1ac20cf2eb342c7b58b660469951612-f1ac20cf2eb342c7b58b660469951612-20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:03:14.680 -04:00] [INF] StartPlaybackTimer : Exited
[2022-10-18 19:03:24.655 -04:00] [INF] Playback stopped reported by app "Jellyfin Android" "2.4.4" playing "Farewell, Cruel Paradise!". Stopped at "27218" ms
[2022-10-18 19:03:25.217 -04:00] [INF] Playback stop tracker found, processing stop : "5f888e9cb24a8aa4f1ac20cf2eb342c7b58b660469951612-f1ac20cf2eb342c7b58b660469951612-20f45eabdcac5e6da46f97adbc80618b"
[2022-10-18 19:03:25.218 -04:00] [INF] PlaybackTracker : Adding Stop Event : 10/18/2022 19:03:25
[2022-10-18 19:03:25.218 -04:00] [INF] Saving playback tracking activity in DB
[2022-10-18 19:03:28.737 -04:00] [INF] User policy for "jellyfin". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2022-10-18 19:03:28.742 -04:00] [INF] StreamBuilder.BuildVideoItem( Profile="Jellyfin Android", Path="/media/backupSGHD1/Anime/Michiko and Hatchin/Season One/Michiko & Hatchin - 1x01 - Farewell, Cruel Paradise!.mp4", AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) "media:/videos/72497315-bc7d-bc95-9ba0-33da62a84cea/stream.mp4?MediaSourceId=72497315bc7dbc959ba033da62a84cea&Static=true&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=2&api_key=<token>&SubtitleMethod=Encode&Tag=37c6e8729f8ce4dd8c7e6c825fd11a51"

Application version

2.4.4

Where did you install the app from?

Google Play

Device information

Samsung Galaxy A13

Android version

Android 12

Jellyfin server version

10.8.5

Which video player implementations does this bug apply to?

kevinmatthe commented 1 year ago

I have the same issue on avc1 mp4 videos, it seems to be random... btw how did u get the log from client?

kevinmatthe commented 1 year ago

this seems to be random on mp4 files, i got issue in the same play but different episode...

kevinmatthe commented 1 year ago

Found some reason for this, perhaps because of some network error: image image

kevinmatthe commented 1 year ago

Compile with the lastest source fixed my problem. Maybe you can also have a try~ @rangeroob

rangeroob commented 1 year ago

@heyuhengmatt thanks for your input I'll give that a shot and report back

Reporting back:

Yes building from source seems to have solved the issue, will use the debug version for now hopefully we can get another release soon, since the last packaged release was in April.

So for anybody running into this issue building the app from source from the master branch seems to fix this issue

kevinmatthe commented 1 year ago

@heyuhengmatt thanks for your input I'll give that a shot and report back

Reporting back:

Yes building from source seems to have solved the issue, will use the debug version for now hopefully we can get another release soon, since the last packaged release was in April.

So for anybody running into this issue building the app from source from the master branch seems to fix this issue

Bad news: I found some new issue in playing high bitrate media with the selft-compiled debug version, showing that media cannot be played by this device using external or integrated player

kevinmatthe commented 1 year ago

I already found the main issue for this new problem; It seems the latest master code will return all NeedTrancode container with SupportsTranscode=false, so that mx player or vlc player cannot play the media. image Due to my no knowlege of kotlin, I cannot exactly figure out why the response of jellyfin server mismatch, but I guess it's because of the sdk version mismatch... I simply add true -> PlayMethod.DIRECT_PLAY to enable direct play for all media source, this is definitely not a good idea, but it can satisfy my need: playing media on Android device with capability of hardware-decoding... If some offical developer can show up, this problem is supposed to be fixed easily, I think. @Maxr1998

Maxr1998 commented 1 year ago

Server and client logs may be mismatched because the web part of the app uses a simpler device profile and only hands off to the native part of the app, where the actual request starts.

I'm thinking it might be an issue specific to a certain type of file, so I'd appreciate an example clip to test & debug it myself if possible. You mentioned it worked when remuxing to mkv, is the same the case when remuxing to mp4 (with codec=copy in ffmpeg)?

kevinmatthe commented 1 year ago

Server and client logs may be mismatched because the web part of the app uses a simpler device profile and only hands off to the native part of the app, where the actual request starts.

I'm thinking it might be an issue specific to a certain type of file, so I'd appreciate an example clip to test & debug it myself if possible. You mentioned it worked when remuxing to mkv, is the same the case when remuxing to mp4 (with codec=copy in ffmpeg)?

Thanks for your patient reply! For a little more info, image

I tested from the latest master branch code, any ContainerBitrateExceedsLimit media will return SupportsTranscode=false along with SupportsDirectPlay=false;SupportsDirectStream=false, so it will throw an error, then cannot play the video.

For same videos, using 2.4.4 client will not trigger ContainerBitrateExceedsLimit, I noticed that there's changes (in git log) that are related to "MaxBitRate", could this be the reason?

Maxr1998 commented 1 year ago

Yes, we now respect the bitrate settings on the latest master branch. However, it's not finished yet. Regardless, it should just normally transcode in that case, and I don't know why transcoding is marked as unsupported for that file. Otherwise transcoding works on your server, right?

kevinmatthe commented 1 year ago

Yes, we now respect the bitrate settings on the latest master branch. However, it's not finished yet. Regardless, it should just normally transcode in that case, and I don't know why transcoding is marked as unsupported for that file. Otherwise transcoding works on your server, right?

Yep, try using ChromeCast will successfully play the media with transcoding, so it's more like an only-external issue?

databoy2k commented 1 year ago

In case someone else stumbles on this thread like I did, trying to sort out this issue, this is fixed in Beta 2.5.0-beta.1. Thx all!

Maxr1998 commented 1 year ago

Let's close this then. We can reopen it if other users still experience this on 2.5.

xangelix commented 1 year ago

is anyone else still experiencing this issue? Server: 1deb9f36ba5822249b8359e311635ea9001d5635 Android Client: both 2.5.0-beta.1 and https://github.com/jellyfin/jellyfin-android/commit/52ee2d7f887608034f92fb1f240350f3c8c95f34 give the same result Phone: Samsung Galaxy S22 Ultra w/ Android 13, One UI 5.0

(The actual video file plays fine from a flash drive with MPV android)

External player set to MPV gives "Media cannot be played by this device" Here's one of the errors:

02-18 18:52:09.433 17240 17240 E MediaSourceResolver: Cannot create JellyfinMediaSource
02-18 18:52:09.433 17240 17240 E MediaSourceResolver: java.lang.IllegalArgumentException: No play method found for My Video (d017ce45-4ee7-f6b6-e978-a34e4e1099c7)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at org.jellyfin.mobile.player.source.JellyfinMediaSource.<init>(JellyfinMediaSource.kt:29)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at org.jellyfin.mobile.player.source.MediaSourceResolver.resolveMediaSource-eH_QyT8(MediaSourceResolver.kt:71)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at org.jellyfin.mobile.player.source.MediaSourceResolver$resolveMediaSource$1.invokeSuspend(Unknown Source:21)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at android.os.Handler.handleCallback(Handler.java:942)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at android.os.Handler.dispatchMessage(Handler.java:99)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at android.os.Looper.loopOnce(Looper.java:226)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at android.os.Looper.loop(Looper.java:313)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at android.app.ActivityThread.main(ActivityThread.java:8741)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at java.lang.reflect.Method.invoke(Native Method)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
02-18 18:52:09.433 17240 17240 E MediaSourceResolver:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Sample Content MediaInfo:

Video
ID                                       : 4
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 10@L4.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 23 min 36 s
Bit rate                                 : 8 022 kb/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                                : 10 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.161
Stream size                              : 1.32 GiB (79%)
Title                                    : SOFCJ AVC 10-bit
Writing library                          : x264 core 142 r2431+42 c69a006 tMod [10-bit@all X86_64]
Encoding settings                        : cabac=1 / ref=4 / deblock=1:-2:-2 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / fade_compensate=0.00 / psy_rd=0.70:0.00 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / fgo=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc=crf / mbtree=0 / crf=17.0000 / qcomp=0.60 / qpmin=10:10:10 / qpmax=38:38:38 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00 / aq-sensitivity=10.00 / aq-factor=1.00:1.00:1.00 / aq2=0 / aq3=0
Language                                 : Japanese
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio #1
ID                                       : 1
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Codec ID                                 : A_FLAC
Duration                                 : 23 min 36 s
Bit rate mode                            : Variable
Bit rate                                 : 1 385 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Frame rate                               : 11.719 FPS (4096 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossless
Stream size                              : 234 MiB (14%)
Title                                    : English FLAC (CTR)
Writing library                          : libFLAC 1.2.1 (UTC 2007-09-17)
Language                                 : English
Default                                  : No
Forced                                   : No
MD5 of the unencoded content             : <removed>

Text #1
ID                                       : 2
Format                                   : ASS
Codec ID                                 : S_TEXT/ASS
Codec ID/Info                            : Advanced Sub Station Alpha
Duration                                 : 22 min 39 s
Bit rate                                 : 30 b/s
Frame rate                               : 0.057 FPS
Count of elements                        : 77
Compression mode                         : Lossless
Stream size                              : 5.06 KiB (0%)
Title                                    : Full
Language                                 : English
Default                                  : No
Forced                                   : No

Server log:

[jellyfin]        | [00:01:24] [INF] [39] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Jellyfin Android 0.0.0-dev.1 playing My Video. Stopped at 276104 ms
[jellyfin]        | [00:01:24] [INF] [43] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Xangelix. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[jellyfin]        | [00:01:24] [INF] [37] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for Xangelix. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True