QLVideo
QLVideo copied to clipboard
Videos are displayed as a static snapshot in QuickLook previews.
would absolutely fantastic if they could be played back like mp4 files do
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.
afaik VLCKit provides VLCMediaPlayer thought it would be possible somehow to initialize that in the QuickLook view?
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).
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 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.
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 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.
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.
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 :-)
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.
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.
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.
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.
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 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 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).
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.
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 mkv playback ist NOT supported... you will however get a static thumbnail for mkv files
@cytec all right, thanks. I wanted to be sure there wasn't something wrong with my installation. :)
/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework/PlugIns/Movie.qldisplay or ./LegacyMovie.qldisplay. (The former uses AVKit, the latter QTKit).
If you rename LegacyMovie.qldisplay to Movie.qldisplay it will work with non-native video containers as on pre-10.9 OS X
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.
I think this is impossible, because all *.qldisplay IDs are hardcoded into QuickLook.framework
The bad news is that I can't see any evidence that OS X looks anywhere outside of /System for such plugins, and the plugin interface (QLDisplayBundle) is undocumented and non-trivial.
Maybe there is a way to choose display bundle programmatically but I don't know how to do this.
If you rename LegacyMovie.qldisplay to Movie.qldisplay it will work with non-native video containers as on pre-10.9 OS X
LegacyMovie.qldisplay does OK on some codec/container combinations if you have Perian installed, but it's painfully slow on some of my .mkv test files. Weirdly it can't handle some combinations e.g. DV, or H.264 in .mts, that Movie.qldisplay handles fine.
I've created a new branch LegacyMovie which defers to LegacyMovie if LegacyMovie can preview the content, and provides static previews otherwise.
For this to work you have to:
- Be running OSX 10.9 or 10.10. (The renaming/symlinking trick doesn't work from 10.11 due to SIP).
- Install Perian or some other source of QT codecs.
- Move /System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework/PlugIns/Movie.qldisplay out the way.
- Symlink LegacyMovie.qldisplay as Movie.qldisplay (
sudo ln -s LegacyMovie.qldisplay /System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework/PlugIns/Movie.qldisplay).
Let me know how it works for you if you try this.
Marginal,
Need some clarification (I'm not well versed in coding/computer terms). When you say "Symlink LegacyMovie.qldisplay as Movie.qldisplay" followed by the terminal commands, do you simply copy and paste that text into terminal? Thanks in advance.
Marginal,
Clarification no longer needed. I just copied and pasted into terminal and it worked like a charm! I even tried it in 10.11 (El Capitan) and it worked! All I had to do was disable System Integrity Protection, add the command to terminal, and re-enable System Integrity Protection. Thanks for this!
LegacyMovie.qldisplay does OK
Marginal, if I'm to understand correctly is there now a workaround that makes QLVideo work (as in play video) with more video formats than before? For example, QLVideo doesn't currently play .flv video formats and shows still images. If I perform the SymLink directions above, will .flv videos play in QuickLook now?
Also, in your instructions you say to move "Movie.qldisplay out the way". Can I just rename it with an underscore in front of it so I can easily change it back later if needed? Also, is changing this stuff risky to the system stability?
The other thing I'm trying to understand - Do I have to use the new branch LegacyMovie you link to for any of this to work? I don't see a package download for it, so I'm confused as to how I should implement it with your instructions above.
Thank you!
The instructions above allow .flv and other "non-native" video types to play in QuickLook on 10.9 and 10.10, and on 10.11 and later if you first disable SIP.
in your instructions you say to move "Movie.qldisplay out the way". Can I just rename it with an underscore in front of it so I can easily change it back later if needed?
Yes.
Do I have to use the new branch LegacyMovie you link to for any of this to work?
That branch has been folded into the master branch. Just make sure you're on the latest release of QLVideo. Actually QLVideo isn't required at all to get .flv videos to play in QuickLook, but it's still useful to have for videos that the LegacyMovie QuickLook plugin can't handle.
Thank you, Marginal. It works great.
Cheers Marginal, works as advertised. Haven't installed Sierra yet, but i assume it works the same way as in 10.11?
christopheranderton, I can confirm the symlink trick still works in Sierra. I had it working in Mavericks, then upgraded to Sierra and during the upgrade process the files were overwritten with new ones and it stopped working in Sierra, of course.
I disabled SIP in Sierra, followed the same steps from the May 5 post above (except I already had Perian installed so that was skipped), then I reenabled SIP in Sierra afterwards. I should note there's a current bug in Sierra 10.12.0 where the Recovery System doesn't show the proper menu bar to get to the Terminal app. I followed some advice here and kept trying until I got the menu bar back and then was able to open Terminal and enable SIP back on again.
Now I'm able to use QuickLook within Sierra on all kinds of formats including .webm, .flv videos that play video within the QuickLook window once again.

Marginal, it does play mp3. It didn't play a .flac file I tested, but I don't think I ever had that working with QuickLook even back with Mavericks and earlier. I couldn’t find any readily available APE audio files to test.

Marginal, thank you so much for all your hard work. I now have all the benefits of Sierra without the drawback of losing QuickLook video on many formats.