[HN Gopher] LosslessCut: lossless video/audio editing
___________________________________________________________________
LosslessCut: lossless video/audio editing
Author : spking
Score : 406 points
Date : 2022-12-13 14:44 UTC (8 hours ago)
(HTM) web link (mifi.no)
(TXT) w3m dump (mifi.no)
| laszlov wrote:
| LosslessCut looks awesome! I also created a lossless video
| trimming tool a couple of months ago: https://videotrim.app
| LosslessCut seems to be more featureful but mine works in the
| browser without having to install it. It also has the same
| limitations since cutting times are rounded to the closest
| keyframes, but this way there's no need to re-encode anything.
| staindk wrote:
| Been using this for a while to cut down gameplay footage I want
| to share with friends. It works well but I wish they implemented
| a simple way to combine multiple audio streams into one stream
| for upload to youtube/elsewhere.
|
| From what I can tell, FFMPEG does support actions like that.
| Perhaps it's not "lossless enough" for the app author.
| veesahni wrote:
| Any tool like this that can handle HEVC? Most seem to only be
| designed for H.264
| wolrah wrote:
| LosslessCut does work with HEVC, but the GUI doesn't support
| playing them so it generates a low-res H.264 video to use as a
| stand-in for previewing and then does the actual cuts on the
| real file.
|
| I mostly use it for cutting up clips from an older GoPro so I
| don't run in to this often but I did borrow a Hero9 recently
| and it worked fine, it just was a bit less streamlined.
| joshschreuder wrote:
| I'm not sure whether this linked on does or doesn't handle
| HEVC.
|
| But Avidemux in copy mode should handle it, I've been using it
| for a while in a similar lossless manner to this tool and it's
| great.
| brink wrote:
| I think avidemux does the same thing.
|
| https://avidemux.sourceforge.net/
| penner_im_auto wrote:
| Came to say that. I've modified avidemux it to drop the checks,
| since then I'm cutting in light speed, it's amazing +1
| joshschreuder wrote:
| Can you elaborate?
| RGamma wrote:
| Or ffmpeg (with 'copy' codec) or mkvtoolnix
| idorube wrote:
| or mpegstreamclip (select in, out & save as)
| TonyTrapp wrote:
| And mp3DirectCut for MP3 / AAC: https://mpesch3.de/
|
| Or mp3splt for MP3 and Ogg Vorbis:
| https://mp3splt.sourceforge.net/mp3splt_page/home.php
| ddevault wrote:
| This project has been my go-to example of the absurdity of
| Electron since its inception. This is a thin wrapper around
| ffmpeg, which does all of the real work here and is a much more
| powerful and versatile tool. Why does this ship an entire web
| browser? Why does this even exist? The world may never know.
| [deleted]
| seba_dos1 wrote:
| Protip: for simple lossless cutting, ffmpeg is more than enough.
| To make a 2 second clip starting from the third second of input
| file:
|
| ffmpeg -ss 3 -t 2 -i in.mkv -c copy out.mkv
|
| [edited to put -ss and -t before -i]
| xienze wrote:
| Of course (pretty sure LosslessCut using ffmpeg under the
| covers). But this is probably one of those instances where
| having a GUI comes in handy. You can quickly scrub the video
| for the exact point you want, see where the closest I frame is
| (read: the place where your cut is going to start), create
| multiple cut segments, etc.
| seba_dos1 wrote:
| For simple cases where you just cut a single clip out of a
| longer file, I find CLI to be faster. For more complex stuff
| like joining several clips together or manipulating multiple
| files, GUI is usually the better option indeed.
| genericacct wrote:
| Losslesscut is infact a front-end to ffmpeg afaik
| donio wrote:
| Yep, it's ffmpeg with 400MB more Electron.
| gyan wrote:
| Don't do this. Place both ss and t before the input -i.
|
| As output options, ss waits till the first KF _after_ the given
| value, it 's not a seek. With a t of 2, that may very well
| result in an empty video stream.
| therealmarv wrote:
| nice, I needed a program like this. is there something similar
| for Android?
| ReptileMan wrote:
| Finally. I have been longing for simple paint.net style video
| editor ...
| RunSet wrote:
| Virtualdub downloads as a 1.81 MB zip file.
|
| This downloads as an 84.9 MB zip file.
|
| I sure hope this does something Virtualdub can't / anything
| better than Virtualdub, my current preferred lossless video /
| audio editing Swiss army knife.
|
| Can anyone confirm whether that is the case?
|
| BTW downloads that don't require approaching Lord Appstore cap in
| hand can be found here:
|
| https://github.com/mifi/lossless-cut/releases
| GloriousKoji wrote:
| Looks like it has better meta-data support and you can mark
| multiple segments of a video, re-arrange and then do a stream
| copy to a new file. I've been using VirtualDub for decades
| (maybe the wrong way) but I think doing the same would have
| required steam-copying the segments to new files and then
| appending them together. Not a fan of the interface based on
| the screenshot but I think it's worth giving it a try.
| gauddasa wrote:
| Statically linked FFMPEG executable is about 80 MB. As there is
| no need to ship entire FFMPEG when only lossless operations are
| to be used, I'm sure it can be reduced below 10 MB.
| wpietri wrote:
| Are people who edit video all that concerned about 80 MB? At
| current prices, that's like $0.005 of disk space.
| ale42 wrote:
| I'm not about the 80 MB... but I'm rather concerned by the
| proliferation of Electron-based applications. They use way
| too much system resources. Like Chrome does... but for a
| browser (which is kind-of a "heavy" application) I still
| understand.
| lacrosse_tannin wrote:
| It runs on my not-windows computer so that's a good start
| kasabali wrote:
| avidemux
| pestatije wrote:
| > This app is not for exact cutting. Start cut time will be
| "rounded" to the nearest previous keyframe, which may be a
| fraction of a second before your desired cut point, or up to
| several seconds, depending on the encoding.
|
| I found this problem with all ffmpeg-based editors...does anybody
| know of an editor capable of cutting between inter-frames? The
| same happens with sound files, which is inconvenient.
| j1elo wrote:
| As has been said, this happens because of cutting on the
| closest keyframe, which is the only point where the cut can be
| done losslessly.
|
| This is how it's been done traditionally, since basically
| forever as far as I can remember. To be honest, I think modern
| tools could do better. If you happen to want a cut just 20
| frames after a keyframe, those 20 frames could be computed
| (decoded) in order to create a new keyframe right in the spot
| you wanted. There are a myriad tools to do the typical lossless
| easy cut, but no idea of one that goes the extra mile to do
| this more advanced technique.
|
| UPDATE: Navigating the GitHub issues I found out that this is
| indeed an in-progress experimental feature! That's amazing --
| https://github.com/mifi/lossless-cut/issues/126
| oefrha wrote:
| > If you happen to want a cut just 20 frames after a
| keyframe, those 20 frames could be computed (decoded) in
| order to create a new keyframe right in the spot you wanted.
|
| All the P-frames and B-frames in between two I-frames have to
| be recomputed. That's by definition re-encoding and not
| lossless.
|
| You could re-encode just that small segment though.
| maria2 wrote:
| This would obviously be codec dependent, but I'm surprised
| it's impossible to losslessly re-encode a video given I, P,
| and B frames. Mentally, I think of P frames as containing
| "changes" in the frame. The changes would be the same
| regardless of whether or not the previous frame was an I or
| P frame.
| brigade wrote:
| Decoding the "changes" can be dependent on the "changes"
| in a previous frame, notably that the prediction for
| motion vectors can come from previous frames' motion
| vectors. Which I frames obviously don't have.
|
| Besides that the only way to losslessly re-encode frames
| is to use lossless encoding, which would easily be a
| 50-100x size bloat.
| oefrha wrote:
| > I'm surprised it's impossible to losslessly re-encode a
| video
|
| It is possible, it will just be a ridiculously large
| video.
|
| > Mentally, I think of P frames as containing "changes"
| in the frame. The changes would be the same regardless of
| whether or not the previous frame was an I or P frame.
|
| P-frames in modern codecs use multiple previously decoded
| frames, not just the previous frame. And I'm not getting
| into the complexity of frame ordering (decoded frames and
| presented frames can be ordered differently).
| maria2 wrote:
| > It is possible, it will just be a ridiculously large
| video.
|
| Ha true, I guess you could encode every P/B frame after
| the cut as an I-frame.
| infogulch wrote:
| Oh so the P frame after the one you want to cut at may be
| looking farther back than just one I frame. I guess you
| could do the lossless cut at the previous I frame as this
| tool does, then also set the start media timestamp to the
| frame that you actually wanted to cut at, as described
| elsetheread by NelsonMinar.
| oefrha wrote:
| > set the start media timestamp to the frame that you
| actually wanted to cut at
|
| You can do that, but it's container format-dependent
| (e.g. mov edit list) and player support is uneven. If the
| player doesn't support it you get extended cut and A/V
| desync.
| dublin wrote:
| It's perfectly possible, just not with the common media-
| mogul owned and propagated video encoding formats. There
| are applications where you need a compressed video stream
| that does not have keyframes, so that you are not blind
| until the next one if one happens to get scrogged in
| transit. (Think things like UAV pilots blowing up things
| halfway around the world.)
|
| These algorithms had methods have existed for 20 years -
| nearly that long ago, I held in my hand a single DVD with
| _thirty_ full-length movies on it - all compressed
| losslessly using such an codec on a laptop. I actually
| accepted a job with the company (they even sent tickets
| for the flight out to Seattle for my first day on Monday)
| before calling me on Friday afternoon to tell me that the
| company had been acquired by a government-related entity
| and my role (being public-facing) was not needed.
| (Pissing me off because I 'd turned down another good
| offer to take theirs!) It's the only time I've ever even
| heard of getting laid off before you start. The company
| vanished from the face of the earth that week...
| BoorishBears wrote:
| They could do much better than that, cut at a keyframe and
| change the metadata to start at the correct time.
|
| You end up with a tiny bit of wasted data, but it's happy
| middle ground compared to having to give up the key selling
| point
| astrange wrote:
| MOV/MP4 files can do that, but most other video formats
| can't.
|
| You can also leave out the B-frames prior to the new
| start time.
| FullyFunctional wrote:
| It would be lossless for the vast majority of the video,
| only the cut point would be lossy. I'm sure that is ideal
| for most people. Sounds like it's in progress.
| acchow wrote:
| B-frames should simplify this a lot. Only this very short
| portion would be re-encoded
| mizaru wrote:
| When cutting with ffmpeg you can use "frame-accurate seeking",
| but you may run into issues down the road (e.g. audio/video
| being out of sync).
| andrewia wrote:
| There's a beta feature to exactly cut, and re-encode just the
| affected "block".
| smallstepforman wrote:
| > does anybody know of an editor capable of cutting between
| inter frames?
|
| https://github.com/smallstepforman/Medo
| seba_dos1 wrote:
| That's not "a problem with ffmpeg-based editors"; that's the
| only way to do it lossless.
|
| Some containers such as Matroska are able to store an offset
| (and ffmpeg does that), so it starts playing from exact wanted
| position even though the actual stream contains data since the
| last keyframe. Some players ignore that though.
| formerly_proven wrote:
| Depending on the encoder the GOP size / keyframe interval can
| be more or less unbounded as well. Typically you'd only have
| a few seconds per, but for example CCTV cameras are happy to
| produce minute-long GOPs. Seeking backwards in a video player
| tends to not work so well at that point, and most NLEs are
| significantly unhappy with such a file.
| _flux wrote:
| I wonder though if this could be solved with edit lists,
| supported e.g. by ISO BMFF. Not all players support them
| completely, though, for example I believe mpv only supports
| one edit, so I guess that's not useful for general purpose
| use..
| btdmaster wrote:
| Could someone check whether avoid_negative_ts[0] would work?
|
| [0] https://video.stackexchange.com/a/18285
| behnamoh wrote:
| > I believe software should be available to everyone, and
| LosslessCut will always be free for anyone to use and look at
| the code.
|
| Costs $18.99 on App Store!
| [deleted]
| ilyt wrote:
| That's the price of devs having to deal with shitty Apple
| ecosystem
| mig39 wrote:
| brew install losslesscut
|
| is free :-)
| danny8000 wrote:
| If you click on the words "always be free", you will be taken
| to the GitHub project, from there click on the release in the
| right column, and then download it for your platform. The
| store links are for the "donation" purchase process.
| QuantumGood wrote:
| Shotcut.org cuts the videos exactly where you want
| jgtrosh wrote:
| But not losslessly
| Gordonjcp wrote:
| You can't do that at all in long-GOP formats without re-
| encoding.
|
| What happens is that every so often it sends a complete image -
| the intra frame - and then sends differences to show what
| changes from frame to frame. This is a complete and utter pain
| in the tits to edit with, so most people transcode to an
| intraframe codec like DNxHR or ProRes although there's
| absolutely nothing wrong with MJPEG or MPEG2 intra-only.
|
| If you don't re-encode, you're limited to cutting at an intra
| frame because that's where it starts drawing from. If you don't
| you get all this weird "ghost trail" stuff happening.
| bentt wrote:
| I love LosslessCut for capturing game footage and making GIFs.
| felixthehat wrote:
| Just tried this on a screen recording I made, really simple way
| to cut out boring bits e.g loading/waiting times, mousing etc.
| Great, I'll use this again!
| amelius wrote:
| Nice, though I'm not a huge fan of the Snap store.
| suby wrote:
| There's also a Flatpak available,
| https://flathub.org/apps/details/no.mifi.losslesscut
| dmos62 wrote:
| I've a semi-related question. What's your workflow for matching
| torrented videos with subtitles that have been provided in the
| same torrent? Often the directory structure is
| Some.video.mkv Subtitles/Some.video/English.0.srt
|
| and my players of choice (mpv and MPC) are unable to
| automatically make the match.
| open-paren wrote:
| I generally follow the Plex format of
| Some.video.mkv Some.video.en.srt
| Some.video.en.forced.srt Some.video.en.cc.srt
|
| https://support.plex.tv/articles/200471133-adding-local-subt...
| bouvin wrote:
| mkvtoolnix to add the subtitles you want as well as remove the
| tracks that you don't need.
| SparkyMcUnicorn wrote:
| My solution was to use Sonarr, Radar, Bazarr, and Plex. Others
| are using Jellyfin.
|
| This setup eliminated 99% of the time I spent on all media
| management.
| jtbayly wrote:
| For lossless audio only editing, and a very polished experience,
| check out
|
| https://www.rogueamoeba.com/fission/
| Pr0ject217 wrote:
| Mac only =/
| jtbayly wrote:
| Sorry. Meant to mention that.
| datagram wrote:
| If you'd prefer something command-line-based, I'd recommend
| mkvmerge: https://mkvtoolnix.download/
|
| FFmpeg also works of course (it's what LosslessCut uses
| internally), but in my experience I've occasionally run into
| files where FFMpeg doesn't properly cut on keyframes and I end up
| with a few seconds of no image at the start of the video. No such
| problems with mkvmerge, and the API is much simpler.
| ripperdoc wrote:
| LosslessCut is great, but I needed something quick when I cleaned
| up old GoPro videos. Just open an mp4/mov in QuickTime Player,
| trim it and save under a new name. It will create a lossless cut.
| If you need several from same video, you would need to repeat the
| process on the original file.
|
| (unfortunately, the trimmed video won't get the same metadata, so
| I also needed to use exiftool -TagsFromFile oldvid.mp4 -all:all
| newvid.mp4 )
| eatbitseveryday wrote:
| Has anyone had experience merging two video files with this tool?
| wolrah wrote:
| I do it all the time, first cutting up my long GoPro videos in
| to the actually interesting segments and then merging those all
| together. Works great.
| dopa42365 wrote:
| As long as the files are the same codec and resolution and
| stuff, it works just fine (I just used this earlier today to
| combine 20 short instagram stories into one video).
| AareyBaba wrote:
| Merging works great. Drag multiple files to the main window. A
| dialog pops up to allow you to select the order of the files.
| Then merge and a new merged file is created.
| noja wrote:
| Can this fix videos where an orientation change happens partway
| through?
| simple10 wrote:
| HN saves the day again. This is exactly what I needed to edit
| some videos on a deadline today. Thanks for posting it! I usually
| use ffmpeg from command line to trim a video but needed to do
| some more complex edits that LosslessCut makes easy.
| at_a_remove wrote:
| I'll keep an eye on this. I have a very technically interesting
| project soon which will require quite a lot of cuts; my thought
| was just "re-encode everything as I-frames" (all of the source
| material consists of clips under four minutes long). This might
| help.
| smcleod wrote:
| Looks neat - $30AUD is pretty pricey for the average user though.
| e1ghtSpace wrote:
| Its free if you get it from their github repo.
|
| https://github.com/mifi/lossless-cut#download
| smcleod wrote:
| Oh that's awesome, I'll get it from there and flick them a
| donation :)
| TheRealPomax wrote:
| Never realised the site was so bad... It's a fantastic tool, but
| it'd be nice if the site opened with why you'd want to use it,
| and what it can do, rather than jumping straight into user
| testimonials from people who mean nothing to you, followed by a
| complete nonsense "them vs us" image set. In what universe does a
| reencode-on-save using any of the dozens of normal tools that
| people use turn a normal video file into a 7 bit palette gif?
| severak_cz wrote:
| I use this cut begining and end of pirate radio broadcast
| recordings (read: big MP3 which I don't want to reencode). Works
| well for this purpose.
| ww520 wrote:
| Nice interface, simple and beautiful.
|
| For casual video audio editing, I usually use Avidemux. Its Copy
| mode is similar in cutting out portions of the video without the
| lengthy re-encoding process. LosslessCut looks nice. I'll give it
| a try.
| christiangenco wrote:
| LosslessCut is a lifesaver for cutting segments out of my
| usually-unedited podcast[1].
|
| The workflow to do a minor edit in a full editor like Final Cut
| Pro looks roughly like:
|
| - open Final Cut Pro
|
| - create a new proj... oh shoot no, a new library? Yeah that's
| right.
|
| - click import and track down the videos on my hard drive
|
| - _now_ create a new project and drag the videos into the
| timeline
|
| - use the blade tool to cut out a segment
|
| - export the video which is... uh... oh yes under the share menu
| bar and then the format needs to be... hmmm... I think export for
| YouTube
|
| - wait approximately `videoLength/5` for the video to export
|
| - oh my goodness my hard drive somehow has `videoSize*4` less
| space
|
| In LosslessCut that workflow looks like:
|
| - open LosslessCut[2]
|
| - drag and drop your videos in
|
| - mark the start and end times of either the segments you want to
| keep or the ones you want to take out
|
| - hit export and... wow, it's already done? How is that
| possible?! And it's just in the same format as my source video!
| Perfect. Oh man and it even saved a little xml file so if I
| happen to open the same file again I haven't lost my human work
| of marking the in and out points.
|
| The cuts are usually slightly off from where I'd ideally like
| them to be, I think because LosslessCut can only cut on
| i-frames[3], but it's a totally fair tradeoff for my use case.
|
| I liked the minimalist editor interface so much I copied the
| timeline part of it for a dedicated social media video clipper
| I'm working on[4].
|
| If you'd like to try it out I strongly suggest installing it from
| GitHub and donating the amount you would've spent in the macOS
| app store. The macOS app store version has fewer disk permissions
| and adds an extra step asking for access to each folder you want
| to edit in.
|
| 1. makers.dev
|
| 2. frustratingly, right clicking a video and selecting "open in
| LosslessCut" doesn't work
|
| 3. i-frames in most video codecs are "key frames" that repaint
| the entire frame. Most frames are p-frames or "predicted frames"
| which just store a delta from the last frame.
|
| 4. thevideoclipper.com
| korv wrote:
| > The cuts are usually slightly off from where I'd ideally like
| them to be, I think because LosslessCut can only cut on
| i-frames[3], but it's a totally fair tradeoff for my use case.
|
| There is an experimental "smart cut" mode where it re-encodes
| the video between your cut and the next keyframe. It will of
| course not be entirely lossless though
|
| https://github.com/mifi/lossless-cut/issues/126
| ericol wrote:
| > The cuts are usually slightly off from where I'd ideally like
| them to be
|
| That is (probably) because the editor uses certain marks in the
| video (I don't remember how they are called) that "group" the
| frames together, and you can't use simple editors to re encode
| the video.
|
| I had this issue some time I tried to cut videos from my gf.
| Then I moved to ShotCut, that cuts the videos exactly where you
| want, although the walkthrough is a little longer.
| xienze wrote:
| Right, it will (by default) align the cut to the nearest I
| frame, which allows the cut to be "lossless." Doing the cut
| anywhere else requires re-encoding part of the video.
| TreeRingCounter wrote:
| CharlesW wrote:
| > _...the editor uses certain marks in the video (I don 't
| remember how they are called) that "group" the frames
| together..._
|
| You almost had it!
| https://en.wikipedia.org/wiki/Group_of_pictures
| rand0mx1 wrote:
| LosslessCut is an electron based application. You can use Video
| Trimmer by Ivan Molodetskikh.
| thunderbong wrote:
| Is it cross platform?
| jancsika wrote:
| Yes, let's lug around an _entire Linux-based operating
| system_ to avoid the memory and harddrive footprint of
| Electron.
| snthd wrote:
| >Video Trimmer by Ivan Molodetskikh
|
| https://gitlab.gnome.org/YaLTeR/video-trimmer
| Mojave3 wrote:
| Used this for ages. People will bring up various alternatives
| (including just strictly using FFmpeg) and I have to wonder if
| the only use case they can fathom is clipping 1 segment out of a
| longer video. All suggested alternatives would involve such a
| garbage workflow and unintuitive experience for any real project.
| I dislike Electron as much as anyone else but it works fine here,
| and does the job better than anything else I've tried. I am very
| comfortable with FFmpeg and have used pretty much any tool you
| can name, I still use Losslesscut daily.
| bouvin wrote:
| LosslessCut is a magnificent tool. I use it as the final step for
| my lecture recordings, which have been disassembled with ffmpeg,
| edited with Audacity, encoded with Handbrake, and finally
| reassembled using ffmpeg. LosslessCut combines the speed of
| ffmpeg with a quick and pleasingly minimal UI.
| existingone wrote:
| Sort of related - anyone know of an open source tool that can
| repair video streams that get broken during the download
| process (using youtube-dl) due to internet interruption.
|
| Everything I've researched into this says that it cannot be
| done because there is final metadata that gets added at the end
| of the stream that is missing. This does not seem right - if
| you have already download frames of video there should be some
| way to recreate any metadata instead of being left with an
| unplayable broken mpg file.
|
| The internet has many shady third party paid products that
| claim to do this but I don't trust them.
| theobr wrote:
| I haven't fallen in love with a piece of software this quickly in
| so long
| dang wrote:
| Related:
|
| _Lossless-cut: The swiss army knife of lossless video /audio
| editing_ - https://news.ycombinator.com/item?id=24883030 - Oct
| 2020 (10 comments)
|
| _LosslessCut - Save space by quickly and losslessly trimming
| video files_ - https://news.ycombinator.com/item?id=22026412 -
| Jan 2020 (1 comment)
|
| _Show HN: LosslessCut - Cross-platform GUI tool for fast,
| lossless video cutting_ -
| https://news.ycombinator.com/item?id=12885585 - Nov 2016 (33
| comments)
| NelsonMinar wrote:
| Been using this for years, it's a very good and simple tool.
| There's a surprising amount of garbage in this space. SEO spam
| infects any searches you do for video editing software. Many
| "cut" tools actually just fiddle some start media timestamp in
| the file so the output file isn't smaller, just a video player
| will start at the right timestamp. Ie: not an actual cut. This
| one does the job.
|
| It's implemented in Javascript with Chromium and the HTML5 video
| player. Not the way I would have thought to do it but makes cross
| platform a lot easier. You can do the same with ffmpeg on the
| command line of course but having a GUI to pick the cut points
| makes all the difference.
| josefresco wrote:
| Can this be used for video compression or is there a better tool?
| Currently I use Handbrake or online tools.
| seba_dos1 wrote:
| This is a tool for explicitly avoiding video compression.
___________________________________________________________________
(page generated 2022-12-13 23:00 UTC)