Comment by hn_submit
17 hours ago
I've supported OpenShot financially in the past, but I'm currently leaning towards LosslessCut and Shortcut.
Most people want a video editor to splice and concatenate video files without any loss or transcoding. I believe this behavior (lossless) should be default on all of these editors.
> Most people want a video editor to splice and concatenate video files without any loss or transcoding
You can do this with mpv. It's an open source cross platform media player.
For example, here's how I set up a tiny Lua script extension[0] to be able to visually cut videos in an intuitive way. It does it in seconds without re-rendering the video by shelling out to ffmpeg.
Years ago I did the same thing with a shell script CLI tool[1], but mpv's visual aspect makes it so much faster and easier to make clips out of a longer video.
[0]: https://nickjanetakis.com/blog/visually-create-video-clips-w...
[1]: https://nickjanetakis.com/blog/create-video-clips-with-ffmpe...
Nice hacks!
I made a similar script to extract clips from a source, possibly multiple files, and compress the result.
https://metacpan.org/dist/App-fftrim/view/script/fftrim
This is very cool! Do you have a similar workflow for stitching those cut clips together?
Video editor app that generates FFmpeg commands https://news.ycombinator.com/item?id=42207002
Thanks.
Not through mpv, but if all of the videos are the same resolution and codec you can use ffmpeg to concat them without needing to re-encode anything.
It could be worth making a little wrapper script for this, but the ffmpeg command itself isn't too crazy. You can Google for "ffmpeg concat multiple videos into a single video without re-encoding".
ffmpeg is super powerful, you can technically resize and alter videos into a consistent format and then encode a new video too.
You have to make a lot of sacrifices for lossless editing, so it’ll probably always be a specialized app or at least a separate tool within an all-purpose NLE. For instance, you’re limited to compatible input streams and you can only cut on specific intervals, depending on encoder settings etc.
I guess an NLE could import clips in a locked mode by default that only supports lossless operations, and you’d have to specifically enable the rest. Could be interesting.
Note on the specific intervals: that's where the clever optimization comes in: leave as-is (passthrough) all not affected sections of the video (basically everything) and only recode the tiny fraction that needs recoding due to the cut being set on a non-keyframe.
That one, I do believe should get more research and implementations. Currently I only know of LosslessCut's "Smart" mode, but I'd like to see other big players of the video editing space improving the state of the art in that direction for simple cuts.
I wonder, rather than re-encoding when starting on a B- or P- frame, could you preserve the entire GOP losslessly but make the earlier content "disappear" on playback by shifting PTS, or bundling several frames into a single frame's payload? Maybe it causes too many problems with players.
1 reply →
LosslessCut is great, but I've had issues with the final export like timing being off, having cut sequence etc. I think it is very particular about encoding/container.
Shotcut is my default video editor, if anyone's trying it on Linux please use their AppImage as it solved most of my headaches when I was using Flatpak version.
If it's lossless, it may change the cut position to enable lossless. If you want cut at an exact place, then all apps need to re-encode which will never be lossless.
For your particular requirement, you can't get lossless quality all the time by any software.
LosslessCut gives you the option to cut at the nearest keyframe, or to re-encode the small portion from the chosen timestamp to the next key frame (at most a few seconds). Sounds lossless enough to me.
For that kind of functionality, I would always recommend Avidemux[0]. It's quite a light package (which I like), and it allows you to do that and some other useful things too.
[0] http://fixounet.free.fr/avidemux/
I absolutely love Avidemux but it doesn't preserve subtitles when removing a middle clip like lossless cut can.
Dunno if it’s just me, but I tried to download it the other day and couldn’t. The windows download link just punts you right back to their own site.
Sourceforge works
or Github https://github.com/mean00/avidemux2/releases/tag/2.8.1
Just checked. Same thing happened to me. For all links, including old versions AND other packages. Seems to be a problem with fosshub. (I am on linux+firefox).
Try Kdenlive