Mpv: Support AirPlay on macOS

Created on 23 Aug 2016  路  12Comments  路  Source: mpv-player/mpv

It would be great to have the macOS bundle support聽AirPlay like QuickTime or Safari does, so that it's easy to project videos or music to my Apple TV.

Just wanted to gauge interest for this and drum up support for it :) regardless, huge fan of mpv.

feature-request mac

Most helpful comment

I recently coded for AirPlay on another project. Implementation requires a lot of things outside the scope of mpv:

  • A Bonjour/mDNS client to listen to AppleTV device broadcasts, to be able to find devices.
  • AirPlay protocol support, which requires sending to a HTTP port of the device, and then receiving answers on a reverse-HTTP server running on your computer.
  • FFmpeg HLS MPEG2TS chunking is essential and cannot be avoided. Because the AppleTV is a locked-down piece of shit device (I own an AppleTV4) that only supports .mp4, .m4v, .mov and .m3u8 (HLS). It doesn't do .mkv or .avi or anything else at all. And out of the available containers, m3u8 is the only one that supports live-streaming external subtitles (the other containers require embedding the subs into the container).
  • The AppleTV also requires transcoding of a lot of media since it only supports some basic H264 profiles. No advanced codecs allowed. The AppleTV4 is the best at H264 but the older ones suck ass at it and only support old profiles.

So that's a lot of things that will never be added to mpv, a desktop media player:

  • An mDNS client.
  • A HTTP server.
  • An FFmpeg-based HLS chunking streaming/live transcoding server.

Unless one of you want to volunteer a few hundred hours of your time to do all of that?

If not, then I suggest: http://airflowapp.com

It perfectly does all of the above and even lets the device itself control the playlist and seeking in the video via the AppleTV remote.

All 12 comments

Unless AirPlay is just exposed as a PCM audio device (in which case you should be able to use it via --audio-device), I don't see this happening.

By option-clicking the speaker icon, it is possible to change the default audio output device to be an AirPlay sink. I wonder if the AirPlay sinks are available as separate PCM devices as well, though this might be more complicated as some of them may need a password, or otherwise need a session mechanism.

This is the AirPlay experience I'm talking about for video (from QuickTime):

screenshot 2016-08-23 16 38 08

because it's usually much easier to just project the video that should be on the Apple TV rather than having to use the TV as an external monitor. With audio, you're right, it's easy enough to change the system output from the menu bar.

or is it possible to support DLNA?

because it's usually much easier to just project the video that should be on the Apple TV rather than having to use the TV as an external monitor.

Well but connecting your TV to your computer should usually offer you 24Hz while an Apple TV can (afaik) still only do 60Hz, even with TV screens that support 24. This means that just by using an Apple TV you deliberately and voluntarily introduce judder which feels a bit weird considering how many people here use technologies to get rid of it (interpolation, smooth motion).

I only use my Apple TV on screens that support 60Hz. That's one of the requirements (essentially) for owning one.

That has nothing to do with the problem.

The video you are playing being 24 fps is the problem as the Apple TV always outputs 60 (doing 3:2 pulldown). You want to play 24 fps content on a 24*x Hz display otherwise you'll get judder. That's why TVs usually are used with 24*x Hz, not 60. Opposed to that, computer displays are usually used with 60 Hz and this being a problem (producing judder) is why all this interpolation stuff was created in the first place (most computer displays don't support 24*x Hz).

Because all current Apple TVs only output 60 fps you are stuck with judder whenever you watch 24 fps stuff (so basically always).
Attaching your computer to the TV allows you to play your 24fps movie on a 24Hz screen. No pulldown, no judder.
You can read more here: https://github.com/mpv-player/mpv/wiki/Interpolation

Would love to see this implemented. Kinda stuck using airserver and it sucks.

I recently coded for AirPlay on another project. Implementation requires a lot of things outside the scope of mpv:

  • A Bonjour/mDNS client to listen to AppleTV device broadcasts, to be able to find devices.
  • AirPlay protocol support, which requires sending to a HTTP port of the device, and then receiving answers on a reverse-HTTP server running on your computer.
  • FFmpeg HLS MPEG2TS chunking is essential and cannot be avoided. Because the AppleTV is a locked-down piece of shit device (I own an AppleTV4) that only supports .mp4, .m4v, .mov and .m3u8 (HLS). It doesn't do .mkv or .avi or anything else at all. And out of the available containers, m3u8 is the only one that supports live-streaming external subtitles (the other containers require embedding the subs into the container).
  • The AppleTV also requires transcoding of a lot of media since it only supports some basic H264 profiles. No advanced codecs allowed. The AppleTV4 is the best at H264 but the older ones suck ass at it and only support old profiles.

So that's a lot of things that will never be added to mpv, a desktop media player:

  • An mDNS client.
  • A HTTP server.
  • An FFmpeg-based HLS chunking streaming/live transcoding server.

Unless one of you want to volunteer a few hundred hours of your time to do all of that?

If not, then I suggest: http://airflowapp.com

It perfectly does all of the above and even lets the device itself control the playlist and seeking in the video via the AppleTV remote.

Or in other words, mpv is not a streaming server.

@wm4 Yep, that's the short of it. It's a media player, not a streaming server. You guys can use mpv's lua support to tell other apps to start streaming to an AppleTV. Someone could quite easily hack something together by finding an AirPlay server app that takes command line arguments, and feeding it mpv's current local file path. 馃敤

closing this because it's not within the scope of mpv and chromecast support was rejected too (#177).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ww7 picture ww7  路  3Comments

beew picture beew  路  3Comments

yuvadm picture yuvadm  路  3Comments

xanadupark picture xanadupark  路  3Comments

WoLpH picture WoLpH  路  3Comments