QuickLookVideo icon indicating copy to clipboard operation
QuickLookVideo copied to clipboard

Videos are displayed as a static snapshot in QuickLook previews.

Open Marginal opened this issue 12 years ago • 79 comments

Marginal avatar Jul 16 '14 17:07 Marginal

would absolutely fantastic if they could be played back like mp4 files do

cytec avatar Jul 24 '14 13:07 cytec

I think that the only way to achieve this with the current QuickLook API would be to dynamically transcode the content into a format that AVFoundation can understand - i.e. into some version of MPEG. This might be just about usable for content that is already encoded as an MPEG stream but within a different container (e.g. within a .flv, .mov or .mkv file). I imagine that it would be painfully slow and lossy for other kinds of content.

Marginal avatar Jul 24 '14 14:07 Marginal

afaik VLCKit provides VLCMediaPlayer thought it would be possible somehow to initialize that in the QuickLook view?

cytec avatar Jul 24 '14 14:07 cytec

You can get a CGContext that VLCMediaPlayer could draw to ('though I didn't manage to get this working myself) by calling QLPreviewRequestCreateContext. But that context is intended for drawing a static bitmap, so I don't think that it can be dynamically updated.

If you could get hold of the Finder's QuickLook preview window/panel then maybe VLCMediaPlayer could draw into that. But I don't know of any way to get hold of the Finder's QuickLook preview window/panel. (There's QLPreviewView, but I think that's for embedding a quicklook preview in your own app).

Marginal avatar Jul 24 '14 14:07 Marginal

Thanks for your work! Maybe you can get videos previewed with a hack like this (not sure yet how to activate intermediate codec or all available codecs in /Library/QuickTime) http://www.quicklookplugins.com/2007/12/16/mkv-matroska-video-files/

magdesign avatar Oct 18 '14 22:10 magdesign

@magdesign No, that sort of approach doesn't work in Mavericks and later because QuickLook no longer uses the QuickTime framework. It uses the AVFoundation framework instead, but AVFoundation has no (published) API for additional formats or codecs.

Marginal avatar Oct 19 '14 16:10 Marginal

Hello, you have 100% more experience with Quick Look than me :-) I have just got an idea for previewing non-native video formats. The minimal requirements is easy activation (Space), playing video and easy cancel (close playing a video with Space). That's what using QL for video is all about. Would it be possible to activate an existing application with QL hotkey (Space) passing a parameter of video file so that the program starts playing a video. When a focus changes, QL generator should send another file name to play. It's essentially abusing QL just to activate playing a video. Since you are using VLC to get metadata and thumbnail, how about running a part or full VLC inside QL preview window? I know it's dirty as hell, but since Maverick, no video QL is available for non H246 MP4. There are a lot of requests nobody is doing much, because Apple is hiding the APIs. What do you think?

jnai7 avatar Oct 22 '14 12:10 jnai7

@jnai7 No; it's not possible to get notified when the default Movie generator starts playing an MPEG file into the QuickLook preview window, neither is it possible to substitute another file at that point. Nor is it possible to get VLC to draw to the Finder's QuickLook preview window for the reasons discussed above.

Marginal avatar Oct 22 '14 15:10 Marginal

Not a solution for this, but i saw someone (was in Japanese, and the URL is dead) using some kind of key action (using most likely a 3rd party solution) that passed the playback to a shell script (workaround style) invoking mplayer (in the example he used a Homebrew installed binary of mplayer). Have been trying myself, but no luck yet (making it seamless or usable).

Some former colleagues working at a Encoding company (they have extremely good communication with Apple), said that they maybe have a solution for this (the issue). I'll keep you posted.

christopheranderton avatar Nov 20 '14 12:11 christopheranderton

The ideal solution would be to do the same as whatever the default Movie generator is doing in order to play the video into the Finder's Preview window. But I've tried and failed to reverse engineer what the Movie generator is doing so unless your guys at Telestream or anyone else can provide some pointers this is currently a dead end.

I hadn't considered the approach of intercepting a keystroke and playing the video directly into a "fake" preview window. I guess the main challenge here is tracking the user's navigation in the Finder window in order to keep the contents of the "fake" preview window reflecting the user's selection - i.e. emulating QuickLook's behaviour. And if that turns out to be too difficult then I'm not sure we've achieved anything worthwhile - after all ⌘-↓ is a perfectly good existing keyboard shortcut for just playing a video file :-)

Marginal avatar Nov 20 '14 14:11 Marginal

Hello. First off, thank you so much for writing this quick look generator. I'm not a developer (I only did a little cocoa programming as a hobby) so this comment may not be helpful or accurate. This is about 3rd-party components for the AVFoundation stack. It might be possible that the "camera import SDK" released with FCP X 10.0.1 allows writing such components. This is mostly speculation, as this SDK is apparently only available to camera manufacturers. An interesting piece of information came from the recent release of the Pro Video Formats 2.0 by Apple. The codecs themselves are provided at Quicktime components, which go in /Library/QuickTime/ and as VideoToolBox components, which go in /Library/Video/. This update also brought MXF (which is a container, not a codec) support in Final Cut. Curiously, playback is enabled by a Quicktime component only, so that QT player X still cannot play MXF files. QT player 7 now does, so does FCP classic (tested in FCP 6). (FCP X 10.1.4, even though it is based on AVFoundation, can use this component (!) to edit MXF file natively (if this component is removed, FCP X complains that a module is missing). Earlier version of FCP X probably won't support that, but I haven't checked). Anyway, there's probably a reason why Apple didn't simply add support for the mxf container right into AVFoundation, which would allow playing mxf files in QT player X and QuickLook. It suggests that the new video frameworks are not ready yet to support other containers (only codecs), or at least not mxf.

jeanlain avatar Jan 03 '15 11:01 jeanlain

Turns out that movie previews aren't produced by the QuickLook generator plugin /System/Library/QuickLook/Movie.qlgenerator. (Presumably this is because QuickLook generator plugins can't produce anything other than static text or images). Instead, movie previews are produced by /System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework/PlugIns/Movie.qldisplay or ./LegacyMovie.qldisplay. (The former uses AVKit, the latter QTKit).

The good news is that these are also plugins, so in theory it might be possible to produce a similar plugin for non-native video files. The bad news is that I can't see any evidence that OSX looks anywhere outside of /System for such plugins, and the plugin interface (QLDisplayBundle) is undocumented and non-trivial.

Marginal avatar Jan 16 '15 13:01 Marginal

Interesting. I suppose that the LegacyMovie plugin isn't used in Mavericks(?). If so, is there a way to force Mavericks to use it? It won't be ideal since mkv and wmv never worked very well with quick look, but it may help. I suppose that an AVFoundation plugin would be better than a qldisplay plugin since it would work in every app using AVFoundations/AVKit as well. AFAIK, neither kind of plugin is documented.

jeanlain avatar Jan 18 '15 13:01 jeanlain

Interesting. I suppose that the LegacyMovie plugin isn't used in Mavericks(?). If so, is there a way to force Mavericks to use it?

It doesn't appear to be used, and I don't know how to force it.

Agree that an AVFoundation plugin would be preferable as more general solution. But a QLDisplayBundle plugin might possibly be easier to reverse engineer.

Marginal avatar Jan 18 '15 19:01 Marginal

Just a ”update”. Maybe it should be posted at some rumour forum than in this thread. You may remove this as this highly off topic, and with no named sources.

I talked yesterday with a friend at the company i mentioned earlier. They have now a somewhat working plugin for Quicklook with video playback for third party codecs (only installed within their own applications in someway, but that includes almost every codec made). But it's very unstable (causing Kernel Panics at it worsts), and is also not developed anymore in-house (and no, they don't want to open source it).

But he said that there is a strong possibility that the Finder will have their own extensions (think Photos.app that is built on adding features with extensions for both Apple in-house and 3rd party) in coming versions of Mac OS X (10.11 maybe?).

When i asked how so, he said they (Apple) is developing a somewhat rewritten (again!) Finder that will get some stuff from iOS (the return of the Simple Finder!), but will also please ”power users” with the just mentioned extensions. According to him, in the internal development version, they used a extension Boilerplate (no surprise of course) and added some of the Photos.app extensions to the Finder (Photos.app will be more integrated in the Finder), but also 1 (internal test) extension showing of some kind of file comparison capabilities you see in the app Kaleidoscope (and other diff apps), and 1 extension for viewing common medical image formats.

That would make it possible for extensions for different 3rd party media codecs (because it's targeted to 3rd party developers. Of course there will be some shortcomings with restrictions and more sandbox features.)

That may sound like just some wishful thinking, but the guy that i worked with, has worked at Apple (Quicktime and Final Cut Pro as i remember), while it was a pretty long time ago, he still have friends inside, but also have some access for testing new things (within the company he works for), which is pretty unusual for Apple. He don't comment on future stuff most of the time, but when he has, everything turned out true (except some minor details that Apple may have changed). I don't out him with this post (taken care of that) if you wonder.

Even if it's 100% true, Apple can change it at anytime (when i met the Quicktime Core Developers at a talk in Sweden 1 month before the release of QuickTime 4.0 back in 1999, they dismissed MP3 support as ”that's just crap pirates using, so there is no way we are adding that”. But as it turned, Steve Jobs himself demanded MP3 support. So they added support only a week before the release).

christopheranderton avatar Mar 18 '15 16:03 christopheranderton

@christopheranderton Any update? I am on 10.11.3 & when I tried to play webm, all I get is a static image. While webp & gifv shows gibberish & html respectively.

qbektrix avatar Mar 19 '16 06:03 qbektrix

@qbektrix I'm sorry, but i think you need to address that to the developers of the media player you are using. This repo is for a Quick Look-plugin by @Marginal and it will not playback unsupported media files. From the README:

This package allows OSX Finder to display thumbnails, static previews, cover art 
and metadata for most types of video files
QuickLook and Spotlight on OSX 10.9 and later understand a limited number 
of media files - mostly only MPEG audio and video codecs within MPEG container files. 
This package adds support for wide range of other codecs and "non-native" media file types, 
including .asf, .avi, .flv, .mkv, .rm, .webm, .wmf etc.

About my earlier post, as you may know, OS X 10.11.x didn't contain any of the features mentioned. It may come in the feature, or not (giving Apple's track record, i wouldn't count on it).

christopheranderton avatar Mar 19 '16 09:03 christopheranderton

While webp & gifv shows gibberish & html respectively.

webp is a static image format. There's a QuickLook plugin for it here.

gifv "files" are actually either mp4 or webm. Sounds like you downloaded some HTML wrapper rather than the video content.

Marginal avatar Mar 19 '16 13:03 Marginal

First of all thanks for your work. Then I didn't understand well: is mkv supported? I mean, I do get the thumbnails, but that's it. And I have VLC installed if it matters.

Michelasso avatar Apr 28 '16 09:04 Michelasso

@Michelasso mkv playback ist NOT supported... you will however get a static thumbnail for mkv files

cytec avatar Apr 28 '16 13:04 cytec