Removing / Overlaying logo on mp4 video format with ffmpeg on linux - linux

I'm trying to remove a logo from an .mp4 video file with ffmpeg on linux machine without re-encoding (for preserving the same quality) with the following command:
ffmpeg -i input.mp4 -vf delogo=x=270:y=190:w=40:h=40 -c:a copy output.mp4
and it gives me the following errors:
Unrecognized option 'vf'
then a new error came up:
Unable to find a suitable output format for 'delogo=x=270:y=190:w=40:h=40'
ffmpeg is always updating and it seems that they change command line arguments a lot so any material or tutorial I find online seems to get outdated quickly ...
I reviewed the documentation but can't get it to work, I think I'm missing something...?
So: What is the correct command line in linux shell? Also, how to view or find out the exact coordinates of the area to be removed before actually removing the logo? And how can I overlay a solid color in a certain area instead of removing the logo transparently?

Unrecognized option 'vf'
What version of ffmpeg? (You should be able to tell from the output of running just "ffmpeg" without arguments.) My guess is that you have a terribly old version, "-vf" is still current syntax.

put the delogo phrase in quotation marks: "delogo=x=270:y=190:w=40:h=40"

Related

How to add custom glsl transition file in ffmpeg command ? Getting error like when adding glsl file is "No such filter: 'gltransition"

I was tried with using command
ffmpeg -i hiking.mp4 -i video2.mp4 -filter_complex "gltransition=duration=4:offset=1.5:source=crosswarp.glsl" -y outputFile.mp4
After running this command getting error like
ERROR MESSAGE
No such filter: 'gltransition'
I found the way to add transitions using ffmpeg-concat library but in this way can add inbuilt transition names but in my case need to add custom transition glsl file in ffmpeg command
How to overcome from this error in windows system?

ffmpeg being inprecise when trimming mp3 files

I want to use ffmpeg to trim some mp3s without re-encoding. The command I used was
ffmpeg -i "inputfile.mp3" -t 00:00:12.414 -c copy out.mp3
However, out.mp3 has a length of 12.460s, and when I load the file in Audacity I can see that it was cut at the wrong spot, and not at 12.414s.
Why is this? I googled a bit and tried some other commands like ffmpeg -i "inputfile.mp3" -ss 0 -to 00:00:12.414 -c copy out.mp3 (which interestingly results in a different length of 12.434s) but could never get the milliseconds to be cut right.
PS. I wasn't sure whether SO was the right place to ask since it isn't technically programming related, however most of the stuff I found on ffmpeg for trimming audio files were stackoverflow questions, e. g. ffmpeg trimming videos with millisecond precision
You can't trim MP3 (nor most lossy codec output) with that level of precision. An MP3 frame or so of padding is added during encoding. (See also: https://wiki.hydrogenaud.io/index.php?title=Gapless, and all the hacks required to make this work.)
If you need precision timing, use something uncompressed like PCM in WAV, or a lossless compression like FLAC.
On Linux you can use mp3splt:
mp3splt -f mp3file.mp3 from to -o output file format
Example:
mp3splt -f "/home/audio folder/test.mp3" 0.11.89 3.25.48 -o #f_trimmed
this will create a "/home/audio folder/test_trimmed.mp3"
For more info to the parameters, check the mp3splt man page here
On Windows you can use mp3DirectCut
mp3DirectCut has a GUI, but it also have command line support

Convert (numerically ordered) bitmap files to video file using avconv

I am attempting to convert a directory full of .bmp files into a .mp4 file (or similar format).
The bitmap files have the following name scheme:
output_N_1024.bmp
Where N is an integer in the range 0 to 1023. (No zero padding / fixed width.)
The command I am using is:
avconv -r 25 -i output_{0..1023}_1024.bmp outputfile.mp4
This appears to run okay, and takes about a minute to convert all 1024, 1024 by 1024 resolution - (confusing?) bitmap images into a new file, outputfile.mp4.
However, when I attempt to open this file with VLC, a black window briefly flashes up and then closes. VLC then goes back to its mode where it waits for you to tell it which file to open next. No error or warning messages appear from VLC, which seems kind of strange since it seems to be refusing to play.
What can I do to fix this? Perhaps my converting command is incorrect?
The problem most likely is that you haven't actually passed the command to encode these files to avconv. This has happened because your shell has expanded the filenames already.
The command i have just managed to get to work on my machine is:
avconv -r 2 -i "%d.bmp" -s 600x400 -an out.ogv
Also for whatever reason it didn't want to work without explicitely giving it the size, but i don't think this is your problem.
In here quotes tell your shell not to touch this string. %d means digits from 1 to whatever the last file is (if you would want them to be 0-padded this would look like %000d to have maximum of three naughts in front).
VLC has then opened and ran my file just fine.

avconv stops converting jpegs to video without proper error message

I have a problem and I hope someone can help:
I'm trying to convert 287000 jpegs into a video. I tried the following command:
avconv -r 360 -i img%06d.jpg -r 30 out.mkv
But I also tried it without the framerate options with the same result:
img%06d.jpg: Input/output error
Does anyone have any idea why this is? The images are all the same format, resolution, etc... but maybe some are corrupt. If this could be the reason for stopping the conversion, is there an option to drop corrupt input images automatically?

Delay audio for a few seconds at the start of audio files (using ffmpeg)

I have been trying to get lots of wav files delayed by 2 seconds at the start using ffmpeg. And so far, even though I have read the manual, I was not able to get it working. Here is my command:
for %%A in (*.wav) do (
ffmpeg -i "%%A" -itsoffset 00:00:02 "%%~NA"1.wav )
And nothing is being changed. Files are simply getting copied. I also tried the same with mp3 files. I also tried mkv and avi (to make sure it was not a container writing issue), but it gives the same result also.
Command is same here and here, but it does not work. Please, help.
You must put -itsoffset BEFORE you specify input. So:
ffmpeg -itsoffset 00:00:02 -i "%%A" "%%~NA"1.wav
Changing the input time offset like that isn't going to do anything noticeable for a single stream, it's meant for fixing out-of-sync issues between audio and video streams.
Do you want to tack on two seconds of silence at the start? If so, one simple way that'd work (although it may feel a bit hackish) is to simply tack on a 2 second WAV full of silence, before the actual input. This would be accomplished by simply adding another -i option before the actual file:
ffmpeg -i 2secsilence.wav -i "%%A" "%%~NA"1.wav
I know this question is over 9 months old, but I came across it and wanted to add some more information about '-itsoffset'. From the ffmpeg trouble ticket pages (https://ffmpeg.org/trac/ffmpeg/ticket/1349):
This command should display file1 content one second earlier than file2 content:
ffmpeg -itsoffset -1 -i file1.ts -i file2.ts -vcodec copy -acodec copy -map 0:0 -map 1:1 out.ts
1) What I see is that -itsoffset adds or subtracts from all the timestamps (both the video and audio streams) in a file. So this option is only going to be useful when remuxing from separate input files.
2) outfile has expected playback behavior with .ts and .mkv containers.
3) It does not work with .avi (no timestamps, so not a surprise)
4) It does not work with .mp4 container (a bug?)
And that is where this issue stands as of today.

Resources