7 ms·
Lazycut: A simple terminal video trimmer using FFmpeg
- utopiah 7mo agoDon't think I need it (using ffmpeg directly or Kdenlive if I need fine edits) but to know that it exists brings me joy, so thank you!
- masterpos 7mo agoYou are welcome! It is nice when you need to quickly crop or trim something and don’t want to launch a video editing app. The repo is owned by a friend, you can leave a star to make him happy :)
- throw101010 7mo agoThe intermediary solution for me between ffmpeg and kdenlive is LosslessCut (https://github.com/mifi/lossless-cut https://github.com/mifi/lossless-cut). Also free and open-source... of course it look less cool than a Terminal UI like the OP, but it's very practical when I don't want to reencode everything, or if I just need to change the format of container (MP4, MKV, etc.).
- nacs 7mo agoLossless-cut has both an HTTP api and a CLI so it could be controlled via a lightweight TUI if someone wanted.
- mrbluecoat 7mo agoI agree. Trim is nice but the killer feature of LosslessCut is cutting a scene in the middle and merge results while maintaining correct subtitles.
- tim-projects 7mo agoI use losslesscut but its package size is absolutely massive. Would really appreciate alternatives like this.
- fdb 7mo agoI keep being surprised of what you can use/abuse the terminal for...
- QuantumNomad_ 7mo agoIt uses a program called Chafa to render the video. https://hpjansson.org/chafa/ https://hpjansson.org/chafa/ Hadn’t heard of Chafa before. Chafa supports outputting to all popular terminal graphics formats according to the Chafa website: Sixels, Kitty, iTerm2, Unicode mosaics. Speaking of which it is also worth to point out that for example sixels were first invented and put into use quite early on: > […] as a way to send bitmap data to the VT200 series and VT320 terminals when defining custom character sets. https://en.wikipedia.org/wiki/Sixel https://en.wikipedia.org/wiki/Sixel In the references if that Wikipedia article you see for example VT330/VT340 Programmer Reference Manual, Volume 2: Graphics Programming from May 1988. https://www.vt100.net/docs/vt3xx-gp/chapter14.html https://www.vt100.net/docs/vt3xx-gp/chapter14.html
- ariym 7mo agoI think this is the first instance I've seen of an actual terminal video player. Very fun to play with.
- mikkupikku 7mo agomplayer, mpv and I think VLC can do it, with the right output driver settings (libcaca or a few other choices.)
- tptacek 7mo agoYou can just use ffmpeg to extract frames, and then just render the raw images with unicode blocks. (There's Kitty Graphics too, but I couldn't figure out how to make terminal UI layout work with it.)
- mikkupikku 7mo agoI'd use ffmpeg to downscale the frames to the terminal size too. There are also various filters that could help quantizing the colors to what your terminal supports. The paletteuse filter will get you free dithering too.
- chadrs 7mo agoyeah I remember learning this trick in like 2007 with libaa and later caca for color. It looks like this app is shelling out to ffmpeg to get the bitmap of a frame and then shelling to something called chafa to covert to nice terminal-friendly video. https://github.com/hpjansson/chafa/ https://github.com/hpjansson/chafa/
- HelloUsername 7mo agoDoesn't -y mean overwrite file? And isn't there a difference between -ss before -i and after -i?
- dylan604 7mo agoyes and yes. I assume no further info is necessary for what I also assumed was rhetorically asked
- mandeepj 7mo agoI guess I can find another implementation to combine trimmed parts after taking out certain scenes?
- hiccuphippo 7mo agoWrite a text file with all the parts like this: file 'file1.mp4' file 'file2.mp4' file 'file3.mp4' Then call ffmpeg like this: ffmpeg -f concat -i files.txt -c copy output.mp4 And I guess you could make an LLM write a {G,T}UI for this if you really want.
- mandeepj 7mo agoThanks! I don't want to just stitch them. Hoping to have a smooth transition and an easy blend. No jerking between scenes.
- faangguyindia 7mo agoI've been using ffmpeg with claude as video editor for long time.
- hsuduebc2 7mo agoYou mean you let create claude command or it itself runs ffmpeg on your local machine and returns you finished cut?
- faangguyindia 7mo agoI just let claude use ffmpeg to edit videos.
- tptacek 7mo agoThis is very cool. I built one of these myself around Christmas; Claude Code can put one together in just a couple prompts (this is also how I worked out how to have Claude test TUIs with tmux). What was striking about my finished product --- which is much less slick than this --- was how much of the heavy lifting was just working out which arguments to pass to ffmpeg. It's surprisingly handy to have something like this hanging around; I just use mine to fix up screen caps. Commenting mostly because when I did this I thought I was doing something very silly, and I'm glad I'm not completely crazy.
- booi 7mo agoYou can use AI to figure out the arguments to ffmpeg. But indeed it seems like there's just a single call to FFmpeg CLI to power the whole thing which is amazing. ffmpegCmd := exec.Command("ffmpeg", "-ss", fmt.Sprintf("%.3f", position.Seconds()), "-i", p.path, "-vf", strings.Join(filters, ","), "-vframes", "1", "-f", "image2pipe", "-vcodec", "bmp", "-loglevel", "error", "-", )
- snthpy 7mo agoI'd love to hear more about your TUI testing with tmux approach.
- bfrjjrhfbf 7mo agoHaving to separately download ffmpeg in the windows distribution does not really make sense Just bundle it
- karlosvomacka 7mo agoafaik winget can automatically manage package dependencies.
- sorenjan 7mo agoI disagree, I don't want another ffmpeg binary, I already have one. Winget works well, especially since this is already a terminal program.
- ftchd 7mo agoPeople that use GUIs/tools for things like ffmpeg, rclone etc really want the developer to autodetect if they have it already, and use that instead of installing a separate version/binary. How do I know? I built one (https://github.com/rclone-ui/rclone-ui https://github.com/rclone-ui/rclone-ui)
- sorenjan 7mo agoI don't find trimming videos with ffmpeg particularly difficult, is just-ss xx -to xx -c copy basically. Sure, you need to get those time stamps using a media player, but you probably already have one so that isn't really an issue. What I've found to be trickier is dividing a video into multiple clips, where one clip can start at the end of another, but not necessarily.
- ramon156 7mo agoI don't find Sharing files with people very difficult, just login to your FTP and give an account to another user. - Person commenting on OneDrive
- sorenjan 7mo agoMissed opportunity to reference the famous Dropbox hn comment. I just think there are other closely related use cases where a separate program can add more value, especially in the terminal. I wouldn't suggest most people should use ffmpeg instead of a gui, those are too dissimilar. Another example is cutting out a part of a video, with ffmpeg you need to make two temporary videos and then concatenate them, that process would greatly benefit from a better ux.
- tptacek 7mo agoPoint of order: the Dropbox HN comment is famously misconstrued. People think it was about Dropbox; it was about the Dropbox YC application, and was both well-intentioned and constructive.
- gyan 7mo ago> with ffmpeg you need to make two temporary videos and then concatenate them It can be done in a single command, no temp files needed.
- c0d3rPrimate 7mo ago[dead]
- 7mo ago
- mhuffman 7mo agoI have been using this one[0] and it is small, fast, and seems to work pretty great for me so far. [0]https://github.com/wong-justin/vic https://github.com/wong-justin/vic
- wonger_ 7mo agoHappy to hear! Some of my thoughts when building it: - I haven't implemented audio support yet, but it would be nice - I like --dry-run - I didn't use a TUI widget library, but now it's at the point where it's tedious to refactor the UI / make it prettier - I like OP's timeline widget - Wanted to focus on static binaries. I got chafa static linking working for Linux, but haven't bundled ffmpeg yet - which reminds me of licenses -- chafa and ffmpeg are LGPL iirc - a couple other notes from early on: https://wonger.dev/posts/chafa-ffmpeg-progress https://wonger.dev/posts/chafa-ffmpeg-progress
- Acrobatic_Road 7mo agoCould have really used this a couple days ago. I had to record a video an assignment, but due to lack of global hotkeys on OBS with wayland, I had to start and stop the video on the OBS GUI. I tried to figure out ffmpeg but I was too tired and it was getting close to the deadline so I spent some time learning how to to do it with kdenlive.
- chris_va 7mo agoInvoking ffmpeg, gzip and tar commands is a sort of reverse Turing test for LLMs
- andai 7mo agoTo access this website, you must produce a valid tar command without alt-tabbing. You have ten seconds to comply.
- zimpenfish 7mo ago> you must produce a valid tar command Define "valid"? If you mean "doesn't give an exit error", `tar --help`[0] and `tar --usage`[1] are valid. [0] For both bsdtar (3.8.1) and GNU tar (1.35) [1] Only for GNU tar (1.35)
- andai 7mo agoDamn, you solved it! https://xkcd.com/1168/ https://xkcd.com/1168/
- pezgrande 7mo agoI feel so bad that I need to google every single time I need to untar and unzip a file :(
- noiv 7mo agoOn MacOs I just press space and trim with finder. Even avoids re-compressing.
- kawsper 7mo agoI asked about this tool 3 days ago, HN is a magical place! https://news.ycombinator.com/item?id=47363432 https://news.ycombinator.com/item?id=47363432
- rishabhjajoriya 7mo ago[flagged]
- mystraline 7mo agoWhat's weird is that I have problems getting the ffmpeg switches right, even if I get llm assistance. I think I understand the switches, and are demonstrably shown I have no clue. These days, I'm basically relegated in following pre-LLM blogs and SO in hoping I find the right combination.
- somat 7mo agoI think it is part of a more general problem, I don't think anybody intends to make a terrible DSL it is just a natural progression from. 1.we have a command line program 2.command line args are traditionally parsed by getopt(or close relative) so we will use that(it's expected) 3.our command line program has grown tremendously in complexity and our args are now effectively a domain specific language. 4.congratulations, we are now shipping a language using a woefully inadequate parsing engine with some of the worst syntax in existence. see also: ip-tables, find I think it would behoove many of these programs to take a good look at what they are doing when they reach step 3 and invest in a real syntax and parser. It is fine to keep a command line interface, but you don't have to use getopt.
- xenodium 7mo agoNeat! I did the Emacs equivalent https://github.com/xenodium/video-trimmer https://github.com/xenodium/video-trimmer
- turtlebits 7mo agoIf you dont like leaving your main video player, IINA on mac is scriptable, so I just use shortcut keys to send start/end indicators to a script which runs ffmpeg on the timestamps. Im sure other video players like VLC support this, but I found VLC's apis very lacking.
- ta8903 7mo agompv has plugins for this like https://github.com/serenae-fansubs/mpv-webm https://github.com/serenae-fansubs/mpv-webm
- nanobuilds 7mo agoIt's interesting how terminal apps are increasing in popularity after decades of desktop and web apps. I wonder if it's the talk to the chat AI that's making people more used to asking a prompt screen or if it's the simplicity and lack of bloat.
- 4k93n2 7mo agobeing true cross-platform is a bigger draw for me. once something works on one platform it will usually work on any other platform that has a terminal. im in the process of switching to neovim as my main editor just so i can have the same setup everywhere. IDEs like vscode are 'cross platform' but only work on desktop, and there are IDE-like editors for android but none of them work on desktop. oddly enough neovim on android/termux is actually easier to use than any of the IDE editor apps mainly due to everything being keyboard based when it comes to writing my own mini programs/scripts, is basically the promise of things like flutter where you can write something once and run it everywhere, only it takes hours instead of days to throw something together and its not as overkill because im just using python or bash and then fzf or textual for any interactive parts
- nesk_ 7mo agoLove it! I had this idea before but never took the time to implement it. You did it, thank you.
- adithyassekhar 7mo ago> winget install ffmpeg Surprised to see the "just" ffmpeg package name. Who's maintaining it? Afaik there's loads of ffmpeg packages in winget[0] 0: https://github.com/search?q=repo%3Amicrosoft/winget-pkgs%20path%3Affmpeg&type=code https://github.com/search?q=repo%3Amicrosoft/winget-pkgs%20p...