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.
iLemming · 25m ago
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.
qiine · 20m ago
this is inspiring, I am slowly getting to that same conclusion but in neovim... if I write text I want all my nvim fancyness... because oh boy is it fancy!
agentultra · 20m ago
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.
kelvinjps10 · 44m ago
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
iLemming · 11m ago
> I don't get using emacs for non text things
What do you mean by "non-text things"? You are dealing with the computer, it's all about text and mostly text. Sure, it might be encoded and digitized, but even structured binary - is all just text. Even when you give a computer voice commands - they are just synthesized audio form of fucking text. Even with "turtles all the way down" - it's all turtles made of text.
Have you seen the gif in the blogpost? With the transient that has "Move Forward/Backward", "Increase", etc. commands? The commands that you'd have to send to the specialized app anyway - Emacs or not. In what form? Fucking text, of course.
layer8 · 36m ago
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.
cmrdporcupine · 21m ago
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.
layer8 · 1h ago
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.
dfltr · 1h ago
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.
sexyman48 · 13m ago
Yeesh, OP merely respawns a new ffmpeg process to extract the next frame
-- a very emacsy, and thus boneheaded, way of emulating a proper GUI.
tombert · 10m ago
I'm not sure how you'd do it "properly" with libavcodec while still doing a regular Emacs plugin.
It's 300 lines and in pure Emacs lisp, it doesn't seem boneheaded to me.
sexyman48 · 9m ago
I'm not sure how to libavcodec while still doing Emacs
I'm glad you see my point.
tombert · 27m ago
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.
finaard · 53m ago
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.
taeric · 1h ago
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.
smw · 1h ago
All of your links to your own posts in your blog seem to be broken -- relative links need a "/" at the beginning, I think?
Hey, thanks for reporting. I had a couple of links that went haywire. Please lemme know if you run into other issues. First link to https://xenodium.com/seek-and-you-shall-find was broken. Should work fine now.
beklein · 2h ago
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.
latexr · 1h ago
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.
beklein · 19m ago
I’m not saying this is better than a GUI, but instead let me give you an example.
Sometimes I have movie clips A, B, and C. I want to trim part of A at the beginning and end, then stitch clip B to it while speeding it up by 2x, and finally add clip C at the end, also trimmed a bit. After that, I want to add some text at specific times for a specific duration. In the end, I’ll export everything in 1080p.
I know all of this can be done with Final Cut or any other video editing app using a GUI, or the cool Emacs tool above...
But for me this would mean (GUI example) downloading the app and watching YouTube tutorials just to learn what to click.
For simple video editing (and other tasks), I sometimes need to get the job done quickly without wanting to learn a whole new tool.
I found out that I can achieve sufficiently advanced video edits with FFmpeg commands produced step by step from a LLM.
If you think this is awful, ok. I thought it was neat and wanted to share the idea.
beepbooptheory · 1h ago
If the LLM is not seeing the video, what does this add for you over just looking up the relevant options?
beklein · 15m ago
In my common use case, I note down the timestamps of the cuts. No LLM needed here.
I know there are options for everything in FFmpeg, and I’m thankful to the community and maintainers for providing such a powerful and well-documented tool. I sometimes just want a quick video edit that doesn’t involve reading the man pages for minutes or hours.
StableAlkyne · 1h ago
> just looking up the relevant options
Not the OP, but ffmpeg's documentation is pretty awful to navigate if you aren't an expert in it. It is very technical and exact, but fails to provide examples for most options.
For example, the fpsmax option says you can set the maximum frame rate using "Hz value, fraction or abbreviation." So now the user has to search for how any of these things are to be specified (does a bare 60 mean 60hz? Do you need to include Hz? Is it case sensitive? What are the abbreviations? What is the fraction a fraction of?). And that's a random option I found in the pile of documentation it has.
Maybe it's useful if you use it every day, but I completely understand why people use GUIs whose purpose is to construct the command. Or even LLMs to do the same thing.
swyx · 2h ago
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?
tombert · 8m ago
Avidemux is ok for what it is. I use it for snipping and stitching stuff together because you can avoid full reencodes when exporting.
latexr · 2h ago
I find my approach lightweight, but it’s still around 80 lines of code so a tad big to share as an HN comment. It also requires a bit of explanation to set up (though once done, it’s incredibly simple to use) and the output is custom to my needs.
Essentially, I already use mpv as my video player, which in addition to being very fast also allows seeking frame-by-frame, saving and returning to positions, and running Lua scripts. So I wrote some Lua which reacts to a specific key press by saving the current video timestamp. Press it again and it records a second timestamp, then it fires off Handbrake CLI (FFmpeg could also work) to do the cutting and save the trimmed file.
If you search online for “mpv cut video” you should find some plugins with that same idea. I have never used them so I can’t attest to how good or bad they are. All the ones I found are larger than my approach, but then again I just made mine do exactly what I want without customisation so that’s to be expected.
One specific advice I’ll give, if you go this approach and are on the Apple ecosystem: Use the Handbrake CLI instead of FFmpeg to do the cutting. FFmpeg was super frustrating and I was unable to get a result where the output video worked properly in Quick Look and sending through iMessage; after too long trying to get it to work and messing with a myriad flags, I switched to Handbrake with no weird settings and it’s been working flawlessly ever since.
xenodium · 2h ago
> Screenflow is the lightest i know of but fails badly at some video formats and sometimes OoMs
I'm a big fan of ScreenFlow, but light it is not ;) If you just want to trim and assuming you are on macOS, QuickTime's "Edit > Trim..." does the job. It's what I used before doing the Emacs thingy.
kccqzy · 1h ago
I consider Handbrake lightweight. It never fails at any video formats I care to test and it also transcodes them to modern video codecs.
jcynix · 2h ago
Lightweight? I don't mind a bit of weight if its versatile. But when I want to do things fast, I use Shotcut (free, open source) which is much easier to use than e.g. ffmpeg. There exist a number of good tutorials showing how to accomplish tasks.
P.S. What's great about tools like emacs or ffmpeg is their usability via a command line and thus scripting. Which even works on an Android device running inside Termux.
When you have a hammer in your hand and try to use it for more than nails.
iLemming · 1h ago
Typical reaction from someone who has no clue. Emacs isn’t a “hammer”; it's more like “glue” - you don't have to do everything _with_ Emacs, but it can definitely mediate and delegate specific tasks to more specialized tools - it can give you the sense of doing everything _through_ Emacs.
Why would anyone do that? Because plain text rocks.
> There is no equivalent in any other communication technology for the social, communicative, cognitive and reflective complexity ¹
And there's simply nothing better today than Emacs for dealing with the plain text. Neovim comes close, but still can't match it.
I know that you are a stalwart Emacs supporter — I've seen your posts before, and still remember your airplane awakening — but don't you think that more carrot than stick would be more effective at convincing people to use Emacs?
trey-jones · 1h ago
This may be a bit pedantic, but Emacs-as-a-hammer metaphor might work better than you intended, since a hammer is definitely useful for more than just hitting nails. This seems pretty neat to me.
bitwize · 2h ago
Hey, has your favorite IDE been used to run German air traffic control?
rickdarlino · 2h ago
Everything seems like a nail these days. Probably uses his smartwatch to spread butter, too.
xenodium · 2h ago
lol I did work in the smarwatch space for a good chunk of time. While I totally get the nail thing, this is as quick/lightweight as it gets after the command line, which is a lot more cumbersome for this use case.
cpldcpu · 1h ago
You what is even easier than using Emacs to operare ffmpeg? Just use claude-code (or one of the other CLI code-agents)...
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.
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.
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.
What do you mean by "non-text things"? You are dealing with the computer, it's all about text and mostly text. Sure, it might be encoded and digitized, but even structured binary - is all just text. Even when you give a computer voice commands - they are just synthesized audio form of fucking text. Even with "turtles all the way down" - it's all turtles made of text.
Have you seen the gif in the blogpost? With the transient that has "Move Forward/Backward", "Increase", etc. commands? The commands that you'd have to send to the specialized app anyway - Emacs or not. In what form? Fucking text, of course.
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's 300 lines and in pure Emacs lisp, it doesn't seem boneheaded to me.
I'm glad you see my point.
I don't really use Emacs but I love that people use it for everything; next step is a non-linear video editor.
https://xenodium.com/emacs-as-your-video-trimming-tool/
Is fixed and also fix various typo in the blog post. Bbut has other bugs, for example, the title link redirect to the bugged URL.
But (the bugged URL):
https://xenodium.com/emacs-as-your-video-trimming-tool Have the problems with relative links you talked about.
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.
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.
Sometimes I have movie clips A, B, and C. I want to trim part of A at the beginning and end, then stitch clip B to it while speeding it up by 2x, and finally add clip C at the end, also trimmed a bit. After that, I want to add some text at specific times for a specific duration. In the end, I’ll export everything in 1080p.
I know all of this can be done with Final Cut or any other video editing app using a GUI, or the cool Emacs tool above...
But for me this would mean (GUI example) downloading the app and watching YouTube tutorials just to learn what to click.
For simple video editing (and other tasks), I sometimes need to get the job done quickly without wanting to learn a whole new tool.
I found out that I can achieve sufficiently advanced video edits with FFmpeg commands produced step by step from a LLM.
If you think this is awful, ok. I thought it was neat and wanted to share the idea.
I know there are options for everything in FFmpeg, and I’m thankful to the community and maintainers for providing such a powerful and well-documented tool. I sometimes just want a quick video edit that doesn’t involve reading the man pages for minutes or hours.
Not the OP, but ffmpeg's documentation is pretty awful to navigate if you aren't an expert in it. It is very technical and exact, but fails to provide examples for most options.
For example, the fpsmax option says you can set the maximum frame rate using "Hz value, fraction or abbreviation." So now the user has to search for how any of these things are to be specified (does a bare 60 mean 60hz? Do you need to include Hz? Is it case sensitive? What are the abbreviations? What is the fraction a fraction of?). And that's a random option I found in the pile of documentation it has.
Maybe it's useful if you use it every day, but I completely understand why people use GUIs whose purpose is to construct the command. Or even LLMs to do the same thing.
any other light weight trimming people have?
Essentially, I already use mpv as my video player, which in addition to being very fast also allows seeking frame-by-frame, saving and returning to positions, and running Lua scripts. So I wrote some Lua which reacts to a specific key press by saving the current video timestamp. Press it again and it records a second timestamp, then it fires off Handbrake CLI (FFmpeg could also work) to do the cutting and save the trimmed file.
If you search online for “mpv cut video” you should find some plugins with that same idea. I have never used them so I can’t attest to how good or bad they are. All the ones I found are larger than my approach, but then again I just made mine do exactly what I want without customisation so that’s to be expected.
One specific advice I’ll give, if you go this approach and are on the Apple ecosystem: Use the Handbrake CLI instead of FFmpeg to do the cutting. FFmpeg was super frustrating and I was unable to get a result where the output video worked properly in Quick Look and sending through iMessage; after too long trying to get it to work and messing with a myriad flags, I switched to Handbrake with no weird settings and it’s been working flawlessly ever since.
I'm a big fan of ScreenFlow, but light it is not ;) If you just want to trim and assuming you are on macOS, QuickTime's "Edit > Trim..." does the job. It's what I used before doing the Emacs thingy.
https://en.wikipedia.org/wiki/Shotcut
P.S. What's great about tools like emacs or ffmpeg is their usability via a command line and thus scripting. Which even works on an Android device running inside Termux.
But haven't worked on it in months. Usable for now if you don't need audio
No comments yet
Why would anyone do that? Because plain text rocks.
> There is no equivalent in any other communication technology for the social, communicative, cognitive and reflective complexity ¹
And there's simply nothing better today than Emacs for dealing with the plain text. Neovim comes close, but still can't match it.
__
¹ Graydon Hoare: Always bet on text https://graydon2.dreamwidth.org/193447.html