Hacker News new | ask | show | jobs
by jackson1way 2268 days ago
Is someone aware of how popular tools do video trimming (also JPEG cropping).

I have been looking for lossless (reencode-less) trimming of videos since the end of 90s and always just found huge video editing tools that never had these features. And then ypu were stuck with some CLI tools where you need to count the number of frames or milliseconds or something like that. Like if a WYSIWYG tool isn‘t what most people would want to use.

How does the native iOS photo editing tool handle video trimming? And photo cropping? iMovie? And what about google android tools? Or popular Windows tools?

I used to crop my photos with XnView, which supports lossless cropping. And I‘m always puzzled this hasn‘t really take off in other popular tools.

Lossless crop of photos and lossless trim of videos should always be included as a feature.

Reencoding sucks.

2 comments

Most video editing software (that I've ever used) supports making clips or setting in/out points in longer videos. This doesn't necessarily make new trimmed clips as files on disk because that's expensive (storage and computation) depending on the video's codecs. Editors also expect to export a wholly new output from source so they don't need to make those intermediate clips. It's like pass by reference instead of pass by value.

On iOS the trimming is done losslessly, when you trim a clip it basically does the same as what `ffmpeg` is doing here. It seeks to the new start time and copies all the GOPs (group of pictures) to the new end point. The camera records video with really short GOPs so the trimming can be pretty accurate. Only if you apply filters or crop the dimensions of the video will the trimmed clip be reencoded. Any iOS software using AVKit can do the same lossless trims, I imagine most editors on iOS do.

When doing rotation I know the Photos app just changes the JPEG rotation flag in the EXIF data. If you send the raw photo to something that ignores or doesn't understand EXIF rotation you'll see just the sensor's default orientation. I believe HEIF works the same way (the container has a rotation atom). When exporting an image (reencoding for sharing or after editing) it will bake in the rotation to the image data, actually performing the rotation to the image.

Great feedback. Thanks alot
When you use ffmpeg with macOS, you can save a lot of reencoding time (a magnitude of time for H.264) by using videotoolbox, the Apple supplied harware acceleration backend.