Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Videos are displayed as a static snapshot in QuickLook previews. #3

Open
Marginal opened this issue Jul 16, 2014 · 76 comments
Open

Videos are displayed as a static snapshot in QuickLook previews. #3

Marginal opened this issue Jul 16, 2014 · 76 comments

Comments

@Marginal
Copy link
Owner

No description provided.

@cytec
Copy link

cytec commented Jul 24, 2014

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

@Marginal
Copy link
Owner Author

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.

@cytec
Copy link

cytec commented Jul 24, 2014

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

@Marginal
Copy link
Owner Author

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).

@magdesign
Copy link

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/

@Marginal
Copy link
Owner Author

@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.

@jnai7
Copy link

jnai7 commented Oct 22, 2014

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?

@Marginal
Copy link
Owner Author

@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.

@christopheranderton
Copy link

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.

@Marginal
Copy link
Owner Author

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 :-)

@jeanlain
Copy link

jeanlain commented Jan 3, 2015

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.

@Marginal
Copy link
Owner Author

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.

@jeanlain
Copy link

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.

@Marginal
Copy link
Owner Author

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.

@christopheranderton
Copy link

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).

@qbektrix
Copy link

@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.

@christopheranderton
Copy link

@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).

@Marginal
Copy link
Owner Author

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.

@Michelasso
Copy link

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.

@cytec
Copy link

cytec commented Apr 28, 2016

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

@Michelasso
Copy link

@cytec all right, thanks. I wanted to be sure there wasn't something wrong with my installation. :)

@digital-pers0n
Copy link

/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.

@Marginal
Copy link
Owner Author

Marginal commented May 5, 2016

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.

@milobmx
Copy link

milobmx commented Jun 20, 2016

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.

@milobmx
Copy link

milobmx commented Jun 21, 2016

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!

@gitguys
Copy link

gitguys commented Sep 20, 2016

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!

@Marginal
Copy link
Owner Author

Marginal commented Sep 21, 2016

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.

@gitguys
Copy link

gitguys commented Sep 22, 2016

Thank you, Marginal. It works great.

@gitguys
Copy link

gitguys commented Aug 11, 2017

@krokofant I just grabbed webm video file from here: http://www.webmfiles.org/demo-files/

It's playing fine with QuickLook, although I did just notice it has an "Open in Chromium" option top-right I never noticed before. And when I do "Get Info" it shows "Open with" Chromium and will play the video preview there in the "Get Info" window. Not sure if that's relevant or not.

screen shot 2017-08-11 at 9 19 32 am

screen shot 2017-08-11 at 9 31 01 am

The only other thing I can think of is maybe you need QuickTime 7 installed? I've also found if I have glitches with QuickLook a restart will sometimes fix it. Please let us know if you get it working or not, I may have some other ideas for you.

@gitguys
Copy link

gitguys commented Aug 20, 2017

@krokofant you ever get your issue with webm resolved?

@krokofant
Copy link

@gitguys Sorry for my delayed answer. I've not found any solution. I've installed updates, reinstalled whatever I could think of incl. iTunes (🤢).

I tested with several previous working webms including a big buck bunny one.

@gitguys
Copy link

gitguys commented Aug 21, 2017

It appears you had it working before. Which OS version was that and which specific macOS version doesn't work now?

Do you have QuickTime 7 re-installed?

https://support.apple.com/kb/dl923?locale=en_US

Do you have an old backup of your 'LegacyMovie.qldisplay' folder somewhere on external drive? Maybe try to dig that up.

Otherwise, it'd appear perhaps something on your system got corrupted. I would try it with a different user account and see if it works that way.

@zxspectrum
Copy link

Quicklook Video play doesn't in 10.13 macOS High Sierra

@ilovezfs
Copy link

@zxspectrum are you saying this only works for <= 10.12?

@zxspectrum
Copy link

it use to work in Sierra. Definitely not working for me in High Sierra. I can see the thumbnail but can't play the movie via quicklook.../

@ilovezfs
Copy link

@zxspectrum https://github.com/Marginal/QLVideo/releases/tag/rel-190 should fix it but I haven't tested it myself. Can you please test it and report back? :)

@krokofant
Copy link

krokofant commented Oct 28, 2017

Success!

  1. Clean install macOS High Sierra
  2. Install a bunch of packages incl. QLVideo via homebrew
  3. Restarted into recovery (cmd+r on boot) and disabled SIP (csrutil disable)
  4. Restarted into macOS
    • Backuped both Movie.qldisplay and LegacyMovie.qldisplay
    • rm -rf Movie.qldisplay
    • sudo ln -s LegacyMovie.qldisplay /System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework/PlugIns/Movie.qldisplay
    • Installed Perian
    • Verified Big Buck Bunny webm played
  5. Restarted into recovery (cmd+r on boot) and enabled SIP (csrutil enable)
  6. Restarted into macOS and everything works

@adriel
Copy link

adriel commented Jan 6, 2018

@krokofant So can you QuickLook play video files like x264 / x265 .mkv files?

@krokofant
Copy link

@adriel I believe so, not sure about x265 though

@adriel
Copy link

adriel commented Jan 6, 2018

@krokofant hmm, might have to give it a try. I've got one of the new MBP's that has hardware support for H.265, so might work here.

@adamwinn
Copy link

adamwinn commented Jan 7, 2018

I tried the steps listed by @krokofant but there were a few disadvantages

  • No scrubber bar at the bottom of the quicklook player
    screen shot 2018-01-07 at 10 37 09 am
  • Took exponentially longer to quicklook a file (30 secs for a .mp4 that played instantly before)
  • .mkv doesn't play

.flv did eventually play but quicklook was spinning for a long time (about 30 secs) before it played

Does anyone know how to get .mkv and .flv files to play via quicklook using regular qldisplay (Movie.qldisplay) and not the Legacy version?

@krokofant
Copy link

I also have bo "scrubber" bar, but it's better than not working at all.

@gitguys
Copy link

gitguys commented Mar 15, 2018

I'm still on Sierra and it sounds like it's degraded pretty badly in High Sierra overall. Is there any possible fixes for the missing scrubber bar, delays and loss of playback for various formats that's being reported here?

@gitguys
Copy link

gitguys commented Apr 27, 2018

I was looking at the latest version and it says it only shows static images for non-standard formats. Does this workaround to have formats such as .asf, .avi, .flv, .mkv, .rm, .webm, .wmf etc no longer work in the new version?

@gitguys
Copy link

gitguys commented May 27, 2018

Does moving video still work in High Sierra like it used to for Sierra? I currently have Sierra with a bunch of video formats working such as .asf, .avi, .flv, .mkv, .rm, .webm, .wmf formats working great with QuickLook and has a scrubber bar. Anyone figure out a way to get the scrubber bar back in High Sierra?

@Iuser7
Copy link

Iuser7 commented Jun 9, 2018

THANK YOU ALL.
This function is very important to me, since I have hundreds of webm and after YEARS there is no better software than the (older) Quicklook to select and see on the run.
I must say there was a little indie plugin called WebMindexer that worked on Windows Chrome, that was ok.
So I Installed QLvideo+Perian on Sierra 10.12.6.
Unfortunately while I can display all of them, there is no audio output. The speaker icon on the ones that have it, is regularly displayed.

@giovariot
Copy link

What if instead of showing some sort of list of static snapshots the quicklook preview actually showed a webpage with some sort of HTML5 player contained in the quicklook plugin itself that using the video codecs could allow to play the video file directly? Would it be possible? Would this allow to bypass the QL static view limitations?

@wmertens
Copy link

wmertens commented Nov 9, 2020

No, because WebKit would have to support the video formats. It would be possible to run a server that does live transcoding, but that's just silly.

This is one of those cases where Apple just did something sucky and that's that.

@giovariot
Copy link

Oh ok, I thought you could do almost everything with html5 and JavaScript :) too bad

@chrisknepper
Copy link

chrisknepper commented Jul 1, 2021

Hey all, I've successfully gotten a webm to play in Quicklook using @giovariot 's idea. In macOS 11.3 (and the associated version of Safari), Apple finally added webm support: https://www.macrumors.com/2021/02/18/safari-to-support-webm-after-11-years/

I have QLVideo installed and using Quicklook directly on the .webm file shows the static frame, but if I create a simple HTML file containing a <video> element whose src is the path to the .webm, it works (including audio and looping the video), see the attached screen capture.

The HTML is the following:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Test</title>
    <style>
      html,
      body {
        width: 200px;
        height: auto;
        background-color: none;
      }
      ::-webkit-media-controls {
        display: none !important;
      }
    </style>
  </head>
  <body>
    <video autoplay playsinline loop>
      <source src="1618931577179.webm" type="video/webm" />
    </video>
  </body>
</html>

Note my (futile) attempts to hide the video controls with CSS (which on my system do not function).

It is not the prettiest but it is a start. Perhaps the QLVideo plugin can, in the case of .webm files, render an HTML file like the above and embed the .webm in the HTML? The biggest two issues are the unwanted controls and dynamically sizing the preview window.

Also, I am not sure if Apple's support for .webm includes all of the common codecs. My sample .webm is from 4chan which only supports VP8 video inside of .webm files; hopefully VP9 and any others would also work.

macOS 11.4, M1 chip

Screen.Recording.2021-06-30.at.7.45.34.PM.mp4

@wmertens
Copy link

wmertens commented Jul 1, 2021

So - a possible solution would be to have a launchd service triggered by a port that gets a file:// URL and transcodes it to something fast that a JS video player can play?

@chrisknepper
Copy link

chrisknepper commented Jul 2, 2021

I'm not sure transcoding would be necessary? Since the macOS 11.3 update seems to allow the system HTML viewer (I assume the same version of webkit that Safari uses) to play webm files out of the box. I notice that the preview generator in QLVideo already creates HTML for one of the paths, so I think just creating HTML in a similar manner in the case of a webm file. But I don't know a whole lot about the macOS APIs unfortunately.

I'm referring to the code here:

NSString *html = @"<!DOCTYPE html>\n<html>\n<body style=\"background-color:black\">\n";

@wmertens
Copy link

wmertens commented Jul 2, 2021

Sure, for webm its fine, but a host of older formats aren't supported. Transcoding is lossy, so best to keep them in their original form.

@milobmx
Copy link

milobmx commented Aug 9, 2023

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.

Has anyone had any luck getting this to work (particularly with .mkv files) in Mojave? Any info would be appreciated, especially from the OG genius, Marginal.

Thanks all!

@Kagami
Copy link

Kagami commented Oct 1, 2023

#3 (comment)

if I create a simple HTML file containing a <video> element whose src is the path to the .webm, it works

That's interesting workaround!

Also, I am not sure if Apple's support for .webm includes all of the common codecs.

Latest Safari supports VP8/VP9/Vorbis/Opus, just not AV1.

@exgphe
Copy link

exgphe commented Mar 27, 2024

Hey all, I've successfully gotten a webm to play in Quicklook using @giovariot 's idea. In macOS 11.3 (and the associated version of Safari), Apple finally added webm support: https://www.macrumors.com/2021/02/18/safari-to-support-webm-after-11-years/

I have QLVideo installed and using Quicklook directly on the .webm file shows the static frame, but if I create a simple HTML file containing a <video> element whose src is the path to the .webm, it works (including audio and looping the video), see the attached screen capture.

The HTML is the following:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Test</title>
    <style>
      html,
      body {
        width: 200px;
        height: auto;
        background-color: none;
      }
      ::-webkit-media-controls {
        display: none !important;
      }
    </style>
  </head>
  <body>
    <video autoplay playsinline loop>
      <source src="1618931577179.webm" type="video/webm" />
    </video>
  </body>
</html>

Note my (futile) attempts to hide the video controls with CSS (which on my system do not function).

It is not the prettiest but it is a start. Perhaps the QLVideo plugin can, in the case of .webm files, render an HTML file like the above and embed the .webm in the HTML? The biggest two issues are the unwanted controls and dynamically sizing the preview window.

Also, I am not sure if Apple's support for .webm includes all of the common codecs. My sample .webm is from 4chan which only supports VP8 video inside of .webm files; hopefully VP9 and any others would also work.

macOS 11.4, M1 chip

Screen.Recording.2021-06-30.at.7.45.34.PM.mp4

I try to make a QuickLook Preview Extension that generates an HTML to play WebM and it works! The preview is animated and the playback controls are displayed normally.

Checkout https://github.com/exgphe/quicklook-webm. Any feedback is welcome!

@exgphe
Copy link

exgphe commented Mar 27, 2024

#3 (comment)

if I create a simple HTML file containing a <video> element whose src is the path to the .webm, it works

That's interesting workaround!

Also, I am not sure if Apple's support for .webm includes all of the common codecs.

Latest Safari supports VP8/VP9/Vorbis/Opus, just not AV1.

I try to make a QuickLook Preview Extension that generates an HTML to play WebM and it works! The preview is animated and the playback controls are displayed normally.

Checkout https://github.com/exgphe/quicklook-webm. Any feedback is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests