14
submitted 2 weeks ago by jherazob@beehaw.org to c/foss@beehaw.org

You have seen them, video clips grabbed off Instagram or TikTok have this EXTREMELY annoying logo and sound at the end (specially Instagram lately, doubly so with headphones). I'd like to just throw a script/command/Bash alias at any of these and have a resulting video without them, and ffmpeg IS the Swiss army knife of video processing, but it's syntax is NOT what you'd call simple. Does anyone have a recipe for this already?

all 8 comments
sorted by: hot top controversial new old
[-] bruce965@lemmy.ml 8 points 2 weeks ago* (last edited 2 weeks ago)

I would recommend checking out LosslessCut. Behind the curtain it runs ffmpeg, so you should be able to find the perfect command.

In the features list:

View ffmpeg last command log so you can modify and re-run modify recent commands on the command line

[-] mox@lemmy.sdf.org 7 points 2 weeks ago

I would try the -to option with a negative duration. (I'm assuming negative duration counts from the end of the file instead of the beginning.)

[-] bbbhltz@beehaw.org 9 points 2 weeks ago

I think this is the easiest. But, -to can't do negative times. You need to nest a different comment inside the FFmpeg command to to the math.

I think this might work to remove 2 seconds from the end of a video

ffmpeg -ss 0 -i in.mp4 -t $(( $(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 in.mp4 |cut -d\. -f1) - 2 )) -c copy out.mp4

[-] unknowing8343@discuss.tchncs.de 5 points 2 weeks ago

This is my (controversial) tip: ask an LLM. It works wonderfully for these cases. "Give me an ffmpeg command that cuts the last X seconds of a video in a lossless manner, stabilizes it and speeds it up 200%".

You can then checkout those commands on the manual/online to verify.

this post was submitted on 04 Dec 2024
14 points (100.0% liked)

Free and Open Source Software

18013 readers
42 users here now

If it's free and open source and it's also software, it can be discussed here. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS