170 points · by pkkm · 3y ago · 111 comments
vidcutter ultimately didn't help in this process. I built it from source and then tried the flatpak, but for all of its beauty, it hung or crashed when importing common but dated formats and containers, handling more than a few clips, and didn't allow precise jogging for splitting (when it didn't hang or crash). It's good for trimming up a smartphone video, but it's not on par with an NLE.
I ended up giving up and scripting out most of the project in ffmpeg and dvdauthor. If you know how to use core utilities, it's such an exercise in tedium struggling against underdeveloped front ends.
I can't mount the file and also can't find any software that can make sense out of the raw CD sectors. Very strange.
Why you'd want DVD menus in the first place, though...
That said, since I've been using an AI assisted terminal (warp.dev currently) my use of GUI wrappers for different tools has faded quite a bit. I like being able to "Clip 0:10 through 0:30 of file.mp4 and turn it into a web optimized gif", and this NLP workflow works as a "wrapper" for almost any CLI. It's a nice interface without the loss of any functionality.
Here's a comparison of both apps with the same video file open and the same clip cut:
Startup time (time between double click and window appears and ready):
- Losslesscut: 2 seconds
- VidCutter: 12 seconds
Time to load the video file:
- Losslesscut: 1 second (to be fair it doesn't show thumbnails)
- VidCutter: 3 seconds
Memory usage:
- Losslesscut: 368MB
- VidCutter: 455MB
Idle CPU usage:
- Losslesscut: 0%
- VidCutter: 0%
Network requests:
- Losslesscut: 7
- VidCutter: 0
Installed size:
- Losslesscut: 455MB
- VidCutter: 178MB
Source, kinda (the memory shown is the sum of all subprocesses. taken when idle so no ffmpeg subprocess included.):
- Losslesscut: 7
Whyyyy
I'd take Electron over that tbh.
I will take that over some stupid app cramming an entire instance of Chromium down my throat any day.
I would love it if someone who knows more about this than I do would confirm/deny since this is something I've been curious about for a long time now. (Though I would also love a tool for near-lossless cutting that just re-encodes the cut GOP, please link such a thing if it exists)
Yes, but then you'd have to render the result into a truly uncompressed format and it would have to stay in that format perpetually. If you wanted to deliver in another lossy format, you'd actually lose quality across the entire file instead of just the one GOP.
What I'm curious about is whether you can cut in the middle of GOPs, recompress the afflicted ones, and then concatenate the stream back together without recompressing all GOPs. If the file specifies a 12-frame GOP, cutting any GOPs is going to break that cadence. So can you have, say, a few thousand 12-frame GOPs... then an 8-frame GOP... then go back to 12-frame GOPs?
Update: Did some research and you can have "adaptive" GOPs of varying lengths: https://docs.aws.amazon.com/mediaconvert/latest/ug/gop-struc...
But whatever you mean, the answer is probably VapourSynth. In fact, you can probably do whatever you are trying to do inside VapourSynth instead of ffmpeg.
Scope-creep would of course require that to expand to include dissolves, transitions, etc until you've got a whole editor/compositor engine running just to playback a single composition.
However this would be quite possible with technologies like WebCodecs+WebGPU.
Decoding two consecutive frames would obviously require two such cycles, which the hardware may or may not be spec’d for. With three, four or n skipped frames, you would require (at least) n frames prebuffering, rendering and graphics memory to guarantee smooth playback.
I think it makes sense to differentiate between mastering formats and consumption formats.
One does not, after all, ship studio masters of albums or songs people listen to.
Matroska supports a feature like this where it can link together multiple segments, letting you do something like having one file for a repeated opening sequence in a TV series.
You cannot make frame-precise cuts within this sequence unless you wish to carry on the frames that won't be visible (and I don't think anyone tries to do these cuts by keeping some invisible frames), so you only get to make such edits that always include the first I-frame of the sequence.
Therefore if you want to make completely lossless edits your editing precision is lost. For frame-precise editing one usually ends up re-encoding the stream.
Of course, you could only re-encode only the GoPs that get broken while keeping the rest intact, and I guess this would be better and a lot faster than re-encoding everything. I don't know if any application tries to do this. But that is also a bit troublesome, as you'd like to use the same encoding parameters—and maybe the same encoder—as the other frames, to not have quality differences between the edits and original.
LosslessCut does have experimental support for this partial re-encode called "smart cut" [1]. Since it's using ffmpeg internally, the challenge become how to instruct ffmpeg to do this[2]?
It's far too fast to be re-encoding the whole video and is too precise to be cutting at the nearest keyframe.
It has limited codec and container support, though.
My experience shows that if you try, this confuses and breaks many (especially hardware) players trying to play that file.
That's exactly what VidCutter does.
There are a few caveats, though. Examples: (1) You're limited to cuts-only edits. (2) Because the base unit of video encoded for distribution is a GOP¹, edits either have to happen on GOP boundaries (i.e. at a keyframe) or the apps have to re-encode the GOP.
The most popular tool in this category that I know of is https://mifi.no/losslesscut/.
¹ The object, vs. the QuickTime Movie file format ² https://en.wikipedia.org/wiki/Edit_decision_list
That's the way video editing in general has always worked.
1) Insert a few title slides in the video with a bit of text and image animation (like text and a logo showing up with some basic animation)
2) Add background music across various parts of the video
I used AviDemux in the past but that was a UX horror.