Live data from Hacker News

Lazycut: A simple terminal video trimmer using FFmpeg

github.com

11–20 of 69 posts

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#11
post #3

I keep being surprised of what you can use/abuse the terminal for...

It uses a program called Chafa to render the video.

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

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

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#13
post #2

Don'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!

The intermediary solution for me between ffmpeg and kdenlive is LosslessCut ( 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.).

I agree. Trim is nice but the killer feature of LosslessCut is cutting a scene in the middle and merge results while maintaining correct subtitles.

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#14

I guess I can find another implementation to combine trimmed parts after taking out certain scenes?

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

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#16
This 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.

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#17
post #6

I think this is the first instance I've seen of an actual terminal video player. Very fun to play with.

mplayer, mpv and I think VLC can do it, with the right output driver settings (libcaca or a few other choices.)

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

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#18
post #6

I think this is the first instance I've seen of an actual terminal video player. Very fun to play with.

mplayer, mpv and I think VLC can do it, with the right output driver settings (libcaca or a few other choices.)

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

Post reply on HN