Live data from Hacker News

Lazycut: A simple terminal video trimmer using FFmpeg

github.com

61–69 of 69 posts

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#61

What'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.

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

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#62
post #47

Earlier quoted context omitted.

There's nothing easy about it. Here's a taste. # make a 6 second long video that alternates from green to red every second. ffmpeg -f lavfi -i "color=red[a];color=green[b];[a][b]overlay='mod(floor(t)\,2)*w'" -t 6 master.mp4; # creates 150 frames @ 25fps. # try make a 1 second clip starting at 0sec. it should be all green. ffmpeg -ss 0 -i "master.mp4" -t 1 -c copy "clip1.mp4"; # exports 27 frames. you see some red. ff…

I've never tried doing frame perfect clips like that, that does sound annoying. But from a cursory read of the source, I don't think this program will solve that issue either? Because the time stamps in your examples are all correct, and the TUI is using ffmpeg with -ss and -t as well. func BuildFFmpegCommand(opts ExportOptions) string { output := opts.Output if output == "" { output = generateOutputName(opts.Input)…

Yer, I noticed that this tool was just doing `-ss -i -t` from its demo gif, which is what prompted me to reply. I'm sure people will discover that all sorts of problems will manifest if they don't start a lossless clip on a keyframe. One such scenario is when you make a clip that plays perfect on your PC, but then you send it someone over FB Messenger, and all of a sudden there's a few seconds of extra video at the start!

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#63
post #47

Earlier quoted context omitted.

There's nothing easy about it. Here's a taste. # make a 6 second long video that alternates from green to red every second. ffmpeg -f lavfi -i "color=red[a];color=green[b];[a][b]overlay='mod(floor(t)\,2)*w'" -t 6 master.mp4; # creates 150 frames @ 25fps. # try make a 1 second clip starting at 0sec. it should be all green. ffmpeg -ss 0 -i "master.mp4" -t 1 -c copy "clip1.mp4"; # exports 27 frames. you see some red. ff…

Can't make frame perfect cuts without re-encoding, unless your cut points just so happen to be keyframe aligned. There are incantations that can dump for you metadata about the individual packets a given video stream is made up of, ordered by timecode. That way you can sanity check things. This is terribly frustrating. The paths of least resistance either lead to improper cuts or wasteful re-encoding. Re-encoding jus…

> Re-encoding just until the nearest keyframe I'm sure is also possible Yer, I've done that, and it's a pain to do "manually" (ie, without having a script ready to do it for you). I've also manually sliced the bitstream to re-insert the keyframe, which if applied to my clip5.mp4 example, could potentially reduce the 50* negative ts frames to maybe 2 or 3. It would be easier if there were tools that could "unpack" and "repack" the frames within the bitstream, and allow you to modify "pointers"/etc in the process - but I don't know of any such thing.

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#64
post #45

Invoking ffmpeg, gzip and tar commands is a sort of reverse Turing test for LLMs

To access this website, you must produce a valid tar command without alt-tabbing. You have ten seconds to comply.

I feel so bad that I need to google every single time I need to untar and unzip a file :(

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#65
post #45

Earlier quoted context omitted.

To access this website, you must produce a valid tar command without alt-tabbing. You have ten seconds to comply.

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

Damn, you solved it!

https://xkcd.com/1168/

Re: Lazycut: A simple terminal video trimmer using FFmpeg

#67
post #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 t…

I'd love to hear more about your TUI testing with tmux approach.
Post reply on HN