jellyfin / Swiftfin

Native Jellyfin Client for iOS and tvOS
Mozilla Public License 2.0
2.32k stars 264 forks source link

Video player doesn't work on Apple TV HD #790

Open makoni opened 1 year ago

makoni commented 1 year ago

Describe the bug

The player doesn't start video playback on Apple TV HD running tvOS 16.4

I've cloned the repo and checked on tvOS simulator and it's easy to reproduce:

  1. Run the app on Apple TV HD Simulator
  2. Try to play a video from a server (I've tried a 1080p video). It won't start playing.

At the same time when I try Apple TV 4K Simulator everything works fine.

I've also tried on a real device - the default player and the native player from experimental settings doesn't work.

Application version

1.0.0(74)

Where did you install the app from?

App Store

Device information

Apple TV HD

OS version

tvOS 16.4

Jellyfin server version

10.8.10

iamnewtogithubhelpme commented 1 year ago

I want to add that I too have same issue. I have 16.x Tvos on apple tv hd and some videos won't Start playing on the apple tv but if I look at the dashboard using my phone on jellyfin, it says the video is playing on apple tv and time too progresses. But on apple tv, it just shows spinning circle on left side at bottom.

holow29 commented 1 year ago

What video codec are these videos in? I'd wager that since Apple TV HD has A8 chip, it is being hindered by the current Device profiles. If that is the issue here, https://github.com/jellyfin/Swiftfin/pull/519 will help.

makoni commented 1 year ago

I tried both HEVC and H.264, same result.

freaky-m0 commented 9 months ago

It's the same on my Apple TV 4.

purevertigo commented 8 months ago

What's the update on this? Some movies don't even play.

gmacarthur commented 8 months ago

For me its every video that requires transcoding on the Apple TV HD, the same content plays perfectly on the Apple TV 4K's in the house.

micer commented 8 months ago

I have the same issue, looks like if I force direct play, the playback is working.

Settings > Experimental > Force Direct Play

Mickey016 commented 8 months ago

I have the same issue with my Apple TV HD. Some movies are not playing, and I can't narrow it down to one parameter only : it's not consistent with the codec, the resolution, the bitrate...

I made a lot of tests by forcing a low value bitrate streaming at the user level (between 3 and 10Mbps) so that the server transcodes every file in x264 and common codecs for the Apple TV HD. I think I have tested every combination of options with Direct Play / fmp4 with HLS / Native Player but nothing succeed.

My results : Native Player breaks every movies Some movies requires the Direct Play option and play fine. But this option breaks other movies (black screen no sound, sometimes with a navigation bar that shows the movie is playing, sometimes with an infinite spinning wheel) that play well with fmp4 with HLS. And vice & versa.

Overall, I think that the best compromise at the time is everything off in the experimental options. It's very strange because some huge BluRay rips are transcoded and played flawlessly. But "smaller" encoded files aren't.

I can confirm that the same user with Swiftfin works flawlessly on Apple TV 4K / iPad Pro 2018 / iPhone 13 mini without any experimental option and with every level of transcode.

ShadowJonathan commented 7 months ago

Other jellyfin clients automatically transcode videos when the current device doesn't work with the file as-is. Together with #678 and #184 I think that currently Swiftfin only pulls the original file without regard for compatibility.

Mickey016 commented 7 months ago

Other jellyfin clients automatically transcode videos when the current device doesn't work with the file as-is. Together with #678 and #184 I think that currently Swiftfin only pulls the original file without regard for compatibility.

I guess you're right. But I wonder if it's the only problem. What surprises me is that, even when forcing a "very low bitrate" transcode (in order to get a x264 file that should be easily OK to process for this device), the playback doesn't work. I would have thought that we could find a solution via transcoding to circumvent this bug till a future fix.

ShadowJonathan commented 7 months ago

even when forcing a "very low bitrate" transcode

If you mean the "maximum allowed Mbps" setting in jellyfin, that's exactly what I'm talking about; Swiftfin bypasses even that.

Mickey016 commented 7 months ago

Yes, that's what I meant. What's strange, is that the FFMpeg logs from the server show that the transcode starts with the correct parameters (1616kb/s in this example) :

Output #0, mpegts, to '/config/transcodes/dce8ebdb850e08dbe6b94f5cf581b091.ts':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264, qsv(tv, bt709, progressive), 720x300 [SAR 1:1 DAR 12:5], q=2-31, 1616 kb/s, 23.98 fps, 90k tbn (default)
    Metadata:
      encoder         : Lavc59.37.100 h264_qsv
    Side data:
      cpb: bitrate max/min/avg: 1616000/0/1616000 buffer size: 3232000 vbv_delay: N/A
  Stream #0:1: Audio: aac, 48000 Hz, 5.1, s16, 384 kb/s
    Metadata:
      encoder         : Lavc59.37.100 libfdk_aac
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.42 bitrate=   0.0kbits/s speed=   5x    
frame=   79 fps=0.0 q=17.0 size=     512kB time=00:00:03.60 bitrate=1163.4kbits/s speed=6.14x 

Despite the transcoding process looks OK and keep on going on the server side, nothing but black screen on the Apple TV :'(

ShadowJonathan commented 7 months ago

Might be then that swiftfin simply doesn't send over the correct profile to jellyfin to encode to, hmm.

ShadowJonathan commented 7 months ago

I found some things:

  1. The way the Transcoding URL got constructed does not work, it causes the player to exit immediately
  2. The profile selection is way too liberal for the Apple TV HD, it requires better tuning, which i will submit
Mickey016 commented 7 months ago

I don't think I understand everything you just said but looks like (great?) progress :) Thanks for your help @ShadowJonathan

holow29 commented 7 months ago
  1. The profile selection is way too liberal for the Apple TV HD, it requires better tuning, which i will submit

Some work on this in #519 as I said earlier in the thread if you want to look.

ShadowJonathan commented 7 months ago

I'm looking at that PR right now, it seems to fix/work ATVHD for me

Ronzkie88 commented 4 months ago

I have the same issue, looks like if I force direct play, the playback is working.

Settings > Experimental > Force Direct Play

Worked for me thanks