back
167 comments
This is impressive, but (and probably because I'm not the intended audience for this post) I don't get it, I kind of want to get it though. With "it" I mean making Emacs do X, where X is something far from editing text files. It always seems to me like playing Doom on a pregnancy test. Sure you can do it, sure it's impressive, but should you?

n.b. I'm a C# developer that has accepted my fate and use Visual Studio to earn a living, though I've made sure I know my tool, flaws and merits, better than most developers I've met/worked with. My first job as a programmer was writing C++ code in Emacs and can't remember anything negative about that experience (other than getting used to ctrl+x, ctrl+s for saving and, by reflex, doing the same in Excel, and losing a big part of the document that I had just selected to move, because Excel couldn't undo past last save).

Reading the (at the time I'm writing this) 13 comments on this post I see mentions of at least three lightweight programs that does this. What other than "the mountain is there" makes someone think Emacs would be the tool for this? As a Resolve user I know what tool I'd reach for even if using a multi GB, Hollywood grade, non linear editor, compositor and color grader for trimming a short video clip is about as ridiculously overpowered as using a sledge hammer to press a key (and I did exactly that just a few days ago).

Like I said, I'm most likely not "getting it", on multiple levels. Please educate me, why would I use Emacs for this or any of the page upon page of "strange" use cases you find if you search for "Emacs" here on HN. I know Emacs is a powerful editor but I can't for the life of me understand why I would use it to trim video clips.

Emacs is weird. I think it changed something in my brain. Before Emacs, I never thought I would ever try controlling video playback from my editor. "Just why?" I probably would've said. I never thought I'd be trying to get the text from the active tab in my browser. Or search through my browser history. Or OCR the content of my clipboard, or control my WM. Dang, before Emacs, it didn't even occur to me to try to type just about any text in my text editor - which now makes absolute sense - why would I ever bother typing in my browser window, Slack, Zoom, or email client?

In Emacs, I have all the tools I need for dealing with text - thesaurus, spell-checking, definition and etymology lookup, search engines, translation, LLMs, etc. Why, oh why, wouldn't I ever try typing anything longer than two words in anything else?

Like, for example, while typing this very comment, I may come across a thought: "I think I already made a similar comment some time ago, let me find it..." What would a regular user do? They'd switch to the browser, navigate to HN, scroll to the bottom, type search query, lookup on the page, jump to the next, keep paging until they find it, copy, switch back, paste... What would an experienced Emacs user do? They'd search for it without ever leaving their editor, grab the stuff from the buffer and paste it - all within just a few keystrokes. Or if I need to find a url in my browser history - I'd just search for it and insert in-place - two keystrokes+search query.

It's not just faster - it is profoundly satisfying and liberating. It gives you the feeling of being in control. You don't have to deal with the quirks of specialized apps; you don't need to memorize tons of their specific keybindings; it gives you a straight path to extracting or injecting plain text.

That's why those who never made a wholehearted attempt to use Emacs just never get it. And those who have, never can understand why others don't even try to recognize the value.

As an Emacs users who often tries to do as many things as possible in Emacs, I would say that the more stuff you can do in Emacs, the more the various features in Emacs compound with each other, giving you more utility.

For example, I use the Verb package for making HTTP requests. So with Emacs as my HTTP client, I can do bulk HTTP request calls with keyboard macros. The HTTP requests can be stored in org-mode. I can write custom Elisp for special authentication scenarios. I can create new commands if I need them.

For this example, I can imagine (haven't used this myself) scenarios like creating a keyboard macro to shave off the first X seconds of a video usable with dired.

Some non-text-editing things in Emacs that are actually extremely useful:

  - Git via Magit
  - Managing files with Dired
  - Media player with Emms
  - RSS feeds with elfeed
  and the list goes on and on...
Using a well thought-out Emacs interface for anything is one of the biggest sources of joy in my technical life.
Modern emacs is surprisingly powerful, far from "Doom on a pregnancy test" (image display and UI widgets are just features).

Looking at the code for this solution (https://github.com/xenodium/dotsies/blob/main/emacs/ar/video...), it's under 400 lines (excluding the require of three very common libraries and an ffmpeg dependency). I'm not actually sure I could pull off this feature in 400 lines of JavaScript (and the binding logic for going from node to ffmpeg isn't going to come to my fingertips nearly as fast as the logic for emacs LISP, although I know that varies from person-to-person).

Plus, once it's in emacs it can glue to other things. If I want to grab video from an email and trim it, I have tools in emacs to fetch particular emails, etc.

I think the most reasonable way to think about emacs hacks like this is "I could do this in a shell script... But why would I when emacs gives me interactivity, a REPL, and the advantages of buffer manipulation as a metaphor?"

An Emacs tool to trim video most likely has a conventional Emacs API, conventional Emacs documentation, and was developed using conventional Emacs user personas. Modulo the skill of the tool’s developer, this means it won’t require a lot of unnecessary brain cycles to learn or use or automate.

It won’t require switching to a browser. It won’t require creating an account. No going to the app store. No license consent. No dangerous program warning. No turn on notifications. No unlock premium features. No an update is available. No marketing emails. No cookies.

It’s just gonna STFU and do what it says it does in a way that makes sense. And if it is good enough, it’s good enough. It won’t add bullshit to your day.

While I'm not an Emacs aficionado and I find some of the stuff that people squeeze into Emacs weird [0], I have to vouch for OP here. It's a front end for ffmpeg. ffmpeg is a text-based utility and Emacs is a text editor. That actually makes sense. And judging by the screengrab it's a lot more ergonomic than plain ffmpeg. If I were an Emacs user I'd definitely consider using this, and it makes me kind of jealous.

[0] recent example from here: a proto social network that runs via org-files-over-http (as if we didn't have a markup language designed for http already) https://news.ycombinator.com/item?id=44889354

There's some truth to the aphorism, "Emacs is a great operating system... if only it had a decent text editor."

I think Emacs is basically an elisp runtime that happens to have primitives like buffers, windows, etc upon which a text editor happened to be implemented.

It's more like a programming environment than a text editor. Sort of like Pharo Smalltalk, for example.

You can implement an HTTP server in elisp. You can render SVG, HTML, PDF. All kinds of things.

I'm not really the type of person to do video editing or web browsing in Emacs, but I can still see the appeal.

A well-tuned emacs install is comfortable. I have my keybindings that do what I want them to do. I can visually organize my emacs frame (what is now called a GUI window) exactly how I want, with files taking up the parts of the screen that I want. I can be reading the README of some project I checked out and be curious about some terms, then just select it and send it off to my LLM. It's trivial to switch between Claude, OpenAI/ChatGPT, and Gemini depending on how much context I need to give.

It's like having personal space organized to your tastes. For some, their personal space can seem on the outside as a warzone of stuff, for others it's meticulously organized and labelled, but the key commonality is that it's personal space and that the owner of the space is comfortable in it. That's what emacs is. I don't need to learn a new set of keybindings or mouse clicks to unlock new functionality, I can just bring it into emacs.

To me the point is that Emacs is a customizable environment that allows you to whip up stuff like that fairly easily, and have it integrate with arbitrary other Emacs stuff. Standalone desktop programs are each their own separate little worlds. Emacs is a more integrated environment in that sense, compared to mainstream operating systems.
In this case, I'd view it more as an interactive mode to use ffmpeg?

That is, it isn't like emacs is the thing that is doing the trimming. It is just providing convenient access to ffmpeg to do that. That it is able to do this using roughly 300 lines of code is quite impressive and largely speaks to why people love doing things in emacs.

It would be one thing if this was code golfed to get to a working state. Reading the code, it is remarkably straight forward interactions with ffmpeg.

Great comment, although I use emacs for everything code, writing, finanaces, task management still all these things are text so I don't get using emacs for non text things
Unity of key bindings is one reason. Consistency of interface. Relative ease of using elisp to write some of these things.

Emacs users typically have a whole pile of customizations, macros, and workflow automations they've written up over the years.

And for things that are text oriented, the ability to work the buffers emacs-style between emacs windows is a joy.

There's a lot of advantages to keeping everything inside emacs.

> It always seems to me like playing Doom on a pregnancy test

you can't do it >:( that reddit post is so annoying to me, the only bit of that which was "pregnancy test" was the plastic shell, everything else was replaced, but everyone keeps going "hey did you know they ran doom on a pregnancy test?"

(and breathe...)

I use exwm as my windows manager [1], so for me, everything is emacs-first. Therefore, trimming a video in emacs is more natural than using another program to do it. I love the experience of using exwm and emacs for everything whenever possible.

[1]: https://github.com/emacs-exwm/exwm

If Emacs hardcodes the start and end times then a (single) benefit I can imagine is that QuickTime's UI (the typical go to) can be mildly frustrating if 100% of focus isn't on the screen. Somehow they manage to make moving a [] annoying. Indeed there are more options though.
I did not "get it" from the post itself, but it linked to a post that mentioned "subed", subtitle editing for emacs with syncing with/control of video playback in mpv. I could see myself doing that and then would be happy if I could also trim the video while I am at it.
hmmm, I'll try. Think of these things like you think about using cli tools. If you ONLY had ffmpeg or imagemagick in isolation, there would be no benefit to using them on the command line. You are working with images and video after all. That's what GUI is for! Even if you end up using them, you use them through a GUI wrapper. I bet Resolve uses ffmpeg somewhere under the hood.

They don't work in isolation, though, and I bet you can easily think up a bunch of usecases for either. They're scriptable and they compose well, after all, so the tradeoff is worth it. You put up with the headache to automate that batch job of changing the intro sequence of the thousand video files and generate new thumbnails and put the new subtitles in one go.

In emacs, everything tends to be composable and scriptable. You are in GUI land but things feel powerful like in CLI land, except discoverable. It's the "vim is the text editor of the unix IDE" idea, except they put the whole unix into your editor. When people jokingly claim it's an OS they're only half joking. It's malleable. You are already running it. You are already familiar with the way it works, with the way you discover features, get help etc. Why start another program for a task like this?

Pretty neat. I use Emacs a lot, and also do quite a bit of video trimming. For people wondering "why Emacs?", here’s the use case: trimming video is mostly about writing down start/end times, sometimes with a note. That’s all text.

If you can turn that text directly into clips without switching to a separate video editor, it’s surprisingly efficient. Of course, this only makes sense if you already live in Emacs, then it reduces context switching, helps to keep the flow. If you don’t, it just looks odd. But it’s not about making a meme out of "doing everything in Emacs" - it is just a small tool that fits the workflow of people who are already in that environment.

This supports the meme of Emacs as an operating system. It would actually be nice if graphical integrations like that could be implemented as easily on our actual OSs.
Emacs is an elisp interpreter.
I love that (and I say this with zero shade intended) you can never really tell which "Use Emacs for x" posts are goofs and which ones are serious.
This is pretty interesting; I had never thought of using Emacs as a video trimming thing, but why not? I've trimmed videos manually with FFmpeg and I've thought about building my own GUI to do it, so Emacs is as good a choice as any.

I don't really use Emacs but I love that people use it for everything; next step is a non-linear video editor.

Other responses were getting at the same ideas, but to put in concisely, an Emacs-based solution is:

1. keyboard driven

2. programmable

3. within an ecosystem they are already within (lightweight, cross-platform, etc).

Great tool! I'm always impressed by how versatile a tool Transient is. I use it extensively as well and there's nothing like it anywhere else.
Transient is indeed very nice, even though I wish its programmable API was simpler and made more sense, sometimes it feels annoyingly quirky and unreasonably complex.

Shameless plug for further ideation and discussion: https://news.ycombinator.com/item?id=44025635 - it's a long video - ~1hr, it's unscripted and unedited. I guess I just couldn't fit all my Transient use cases in a smaller one. I have a lot of these bad boys in my Emacs.

Massive kudos on this! Could see elevating this to a full blown "ffmpeg-mode" that allows other forms of editing that is common from that tool.
I had a daydream about a DJ using Emacs once
We are out here.
Years ago, a friend of mine said to me:

  Given enough time, any actively maintained application will 
  become an operating system.
This has held for emacs, Microsoft Excel, Microsoft Word, and probably vim as well.

Honorable mentions for AutoCAD, Blender, and Eclipse too.

:-)

And the browser, which is functionally now a virtual machine with sandboxing that also happens to have native support for HTML rendering and a couple natively-interpreted languages.
> The solution relies on ffmpeg to do the heavy lifting and is roughly 300 lines of code

Checked the source and it seems to make a lot of assumptions on the output format, codec and quality.

Having been an Emacs user for 25+ years, I have a bunch of muscle memory.

So I created Emacs shortcuts for Davinci Resolve. (I create a lot of videos, and every time I've attempted to outsource editing, it has always been more work to review and give feedback than to just do it myself. I have a routine using the AI transcription features of Resolve that lets me edit video very fast. Editing a one-hour video might take 2-3 hours).

I'm also interested in hearing more about your process. I get bogged down going through my footage either comparing similar options, or trimming to the best action (best focus, least shake). I find the default Resolve keyboard shortcuts to be fast, and trim in the Edit mode (whatever #4 is called), but I'd love an AI augment that colour-coded clips based on which segments might be best (e.g., eyes/face in focus, or require least stabilisation, etc).

I have a Resolve Speed Editor panel but just found that to be far slower than the keyboard.

Could you explain your workflow in a video?
I've been using emacs for light video editing too, but I took a different approach. Instead of having emacs deal with video directly, I use emacs as a JSON IPC client of mpv, over a unix socket, which handles the video. Over that IPC link I can control mpv playback (optional) and get timestamps/etc to add into an Edit Decision List (EDL) file.
Very cool tool, and always amazing what Emacs can do...

If this isn’t your _daily_ use case and you only need to edit video from time to time, just ask your preferred LLM to give you the FFmpeg commands to cut, speed up, mute, flip, add text, etc. This has worked quite well for me with simple use cases, and well no need to learn Emacs.

That’d be an awful way to cut video, because it wouldn’t help with the most important part: visualising and extracting the exact initial and final time stamps.

Especially if you don’t do this regularly, a GUI makes much more sense and saves you the frustration of having to sift through potentially wrong commands and figuring out what exactly to edit to fix the mistakes.

Nice, I was just about to do something like that as I didn't find anything ready last week when I got annoyed yet again when trimming a video.
All of your links to your own posts in your blog seem to be broken -- relative links need a "/" at the beginning, I think?
i love this but dont use emacs. i wish that existing tools were lighter weight at video trimming. Screenflow is the lightest i know of but fails badly at some video formats and sometimes OoMs. if it had a better architecture streaming bytes i feel like it might not have that problem.

any other light weight trimming people have?

Impressive, but I'll stick with LosslessCut (https://github.com/mifi/lossless-cut)
Author needs money from you but lives in London. Maybe he should move somewhere cheaper
When you have a hammer in your hand and try to use it for more than nails.
You what is even easier than using Emacs to operare ffmpeg? Just use claude-code (or one of the other CLI code-agents)...
Everything seems like a nail these days. Probably uses his smartwatch to spread butter, too.