applying multiple filter ffmpeg - ffmpeg

I'm trying to rotate videos and increase its sound as well as change itsframe rate
ffplay -i C:/Users/thota/OneDrive/Desktop/VET/Input.mp4 -af "volume="10.0",atempo="10.0" -vf "transpose=2,transpose=2,setpts=1/"10.0"*PTS,scale="3840:2160",fps="5.0"
I'm using FFmpeg as I'm trying to build a video editing application hence I need to combine many operations when i try to use above command I'm getting this error(in command im using ffplay as I just want to see output)
error
[atempo # 000001fdd50c7c40] [Eval # 00000047b79fe770] Undefined constant or missing '(' in
'vftranspose=2'
[atempo # 000001fdd50c7c40] Unable to parse option value "10.0 -vf transpose=2"
[atempo # 000001fdd50c7c40] [Eval # 00000047b79fe770] Undefined constant or missing '(' in
'vftranspose=2'
[atempo # 000001fdd50c7c40] Unable to parse option value "10.0 -vf transpose=2"
[atempo # 000001fdd50c7c40] Error setting option tempo to value 10.0 -vf transpose=2.
[Parsed_atempo_1 # 000001fdd50c7b40] Error applying options to the filter.
Error initializing filter 'atempo' with args '10.0 -vf transpose=2'
Pleas help me solve this issue and suggest me a best way to add multiple operations when i try to use , its being tough so is their any other way
If yes please let me know
Thank you

It looks like you are missing quotation marks " character in two places.
The following command works (weird audio, but no errors):
ffplay -i C:/Users/thota/OneDrive/Desktop/VET/Input.mp4 -af "volume="10.0",atempo="10.0"" -vf "transpose=2,transpose=2,setpts=1/"10.0"*PTS,scale="3840:2160",fps="5.0""
You don't need all the quotation marks, and you may improve readability by using '' instead of nested "".
The following command is equivalent:
ffplay -i C:/Users/thota/OneDrive/Desktop/VET/Input.mp4 -af "volume=10.0,atempo=10.0" -vf "transpose=2,transpose=2,setpts=1/10.0*PTS,scale='3840:2160',fps=5.0"

Related

ffmpeg: option `unity` or `silence` not found for `afade`

I would like to use unity and silence parameters of afade filter as documented here. To achieve partial fade-out, but getting an option not found error.
I am using ffmpeg version 5.1.2.
To reproduce:
ffmpeg -f lavfi -i "sine=frequency=500:duration=5" -filter_complex "afade=start_time=1:type=out:unity=0.1" -y test.wav
Error:
[Parsed_afade_0 # 0x148004c30] Option 'unity' not found
[AVFilterGraph # 0x148004ba0] Error initializing filter 'afade' with args 'start_time=1:type=out:unity=0.1'
Error initializing complex filters.
Option not found
They are currently available in git master builds, and will be available in ffmpeg 5.2 onwards.

FFmpeg: use absolute path in "metadata=print:file="

I'm using FFmpeg to extract frames of a video and therefore I want to print the metadata of the video to a text file first (to get the scene\ value of each frame).
This already works for me with something like:
ffmpeg -i input.mp4 -vf "select='gte(scene,0)',metadata=print:file=scenescores.txt" -an -f null -
Because I'm using all this inside of a Java application I want to pass an absolute path (of an temp directory) to print:file= instead of the currently relative one which will write it to the root directory of the project.
But when I try to specify an absolute path like D:\scenescores.txt I get the following error:
[metadata # 00000203282ff0c0] Unable to parse option value "scenescores.txt" as boolean
[metadata # 00000203282ff0c0] Error setting option direct to value scenescores.txt.
[Parsed_metadata_1 # 00000203269bdf00] Error applying options to the filter.
[AVFilterGraph # 0000020328020840] Error initializing filter 'metadata' with args 'print:file=D:\scenescores.txt'
Is there any way to achieve printing to an absolute path? Am I missing some escape rules or something?
I played a lot with escaping different things and in the end it worked for me like this:
ffmpeg -i input.mp4 -vf "select='gte(scene,0)',metadata=print:file=\'D:\scenescores.txt\'" -an -f null -
The difference is that the path is surrounded by \'.
Also I read that escaping \ to \\ or / can help sometimes.

What does `-map data-re` option in FFMPEG do?

I am trying to extract and parse KLV data from a video stream. I found the following example in a Github repository. I am wondering what does the mapping option data-re do?
$ ffmpeg -i Day\ Flight.mpg -map data-re -codec copy -f data -
I understand the rest of the command, and know that -map is used to choose streams from inputs. But what does data-re mean. I couldn't find any explanation for it (or similar mapping option or stream identifier) in the documentation, e.g. here and here.
It's a typo and incorrect. The only time you use arbitrary label names is when using -filter_complex.
Use:
$ ffmpeg -i Day\ Flight.mpg -map 0:d -c copy -f data -
I could understand a user trying data, but data-re? Might be a double typo for -map data -re, where -re is intended to be the "Read input at native frame rate" input option (-map data is still invalid in this case).
It's not a valid value currently. It could possibly have been a value historically, but I doubt it. Most likely, it "worked" because the map arg parser would ignore additional letters if a lazy evaluation matched a stream and the d in data-re would match data streams. The parser is no longer that clumsy.

FFmpeg - Rotating at angle

I've been working through FFmpeg, but I have been unable to get a rotation to run from the examples they have on their site. I am trying to "wiggle" a video back and forth at a fixed point on the bottom - think a head moving left to right (and so on).
I am attempting to do this with the filter "rotate" (https://ffmpeg.org/ffmpeg-filters.html#rotate). Attempting to use their examples, I get an error.
This is what I have so far:
ffmpeg -i vid1.mp4 -i vid2.mov -loop 1 -i image.png -filter_complex "\
[2:v]alphaextract, scale=240x160[mask];\
[0:v] scale=240x160, rotate=A*sin(2*PI/T*t) [ascaled];\
[ascaled][mask]alphamerge[masked];\
[1:v]scale=480x360[background];\
[background][masked]overlay=120:20"\
-c:a copy 65B6354F61B4AF02_HD_sq.MOV
I am using "rotate" directly from an example in an attempt to get something to run at all.
The error I get back is:
[Parsed_rotate_3 # 0x7ff4476045e0] [Eval # 0x7fff5b3e3f00] Undefined constant or missing '(' in 'T*t)'
[Parsed_rotate_3 # 0x7ff4476045e0] Error occurred parsing angle expression 'A*sin(2*PI/T*t)'
[Parsed_rotate_3 # 0x7ff4476045e0] Failed to configure output pad on Parsed_rotate_3
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
If I remove 'A', 'T', 'sin', etc, rotate does actually work, but far from the desired behavior.
Am I missing something to expose those params?
In the expression,
rotate=A*sin(2*PI/T*t)
A and T aren't literals. The user is meant to replace them with numerals, representing the amplitude in radians and period in seconds repsectively.
e.g.
rotate=2*sin(2*PI/3*t)
Give a try to the transpose filter, for example, Rotate 90 clockwise
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
For the transpose parameter you can pass:
0 90CounterCLockwise and Vertical Flip (default)
1 90Clockwise
2 90CounterClockwise
3 90Clockwise and Vertical Flip

Why isn't my bash script working?

I'm trying to get this bash script to work but am at a loss. I have a text file that contains a list of frame numbers line by line. ffmpeg reports the error:
Undefined constant or missing '(' in '$name)'
The script
#!/bin/bash
source text.txt
while read name
do
ffmpeg -i result.mp4 -vf "setpts=N+1,select='eq(n,\$name)'" -vframes 1 frame-$i.jpg
done <text.txt
You are escaping the $ before variable name i.e. $name, so the $name will be treated literally without any variable expansion being done.
Do:
ffmpeg -i result.mp4 -vf "setpts=N+1,select='eq(n,$name)'" -vframes 1 frame-$i.jpg

Resources