ffmpeg insert black to video head/tail - filter

I tried to carry out the matter of the title.
ffmpeg -i "${in}" -vf tpad=5,start_duration=5,color=black -af adelay=5s,all=1 "${out}"
Console Error:
Only '-vf tpad=5,start_duration=5,color=black' read, ignoring remaining -vf options: Use ',' to separate filters
Only '-af adelay=5s,all=1' read, ignoring remaining -af options: Use ',' to separate filters
No such filter: 'all'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:1
Conversion failed!
I can hardly understand this legacy.
Thanks in advance.

Always test the ffmpeg command before you integrate it into a script. Use are using commas (,) instead of colons (:). Use:
ffmpeg -i "${in}" -vf "tpad=5:start_duration=5:color=black" -af "adelay=5s:all=1" "${out}"

Related

Unable to parse option value xxx.srt as image size in ffmpeg

I had already set environment variable for the ffmpeg in my windows,want to embed the srt file into my mp4 file with ffmpeg:
ffmpeg -i f:\sample\dance.mp4 -vf subtitles='f:\sample\dance.srt' f:\sample\out.mp4
It encounter a strange error:
Press [q] to stop, [?] for help
[subtitles # 0000000002c2fd00] Unable to parse option value "sampledance.srt" as
image size
Last message repeated 1 times
[subtitles # 0000000002c2fd00] Error setting option original_size to value sampl
edance.srt.
[Parsed_subtitles_0 # 00000000005410c0] Error applying options to the filter.
[AVFilterGraph # 0000000002940440] Error initializing filter 'subtitles' with ar
gs 'f:\sample\dance.srt'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!
I copy the files dance.mp4 and dance.srt into f:\ffmpeg\bin,then do the following:
cd \d f:\ffmpeg\bin
ffmpeg -i dance.mp4 -vf subtitles=dance.srt out.mp4
It works fine, how can make ffmpeg parse the option value f:\sample\dance.srt properly,make the command execute normally in my windows?
ffmpeg -i f:\sample\dance.mp4 -vf subtitles='f:\sample\dance.srt' f:\sample\out.mp4
#kesh,it is no use to write as below:
ffmpeg -i f:\sample\dance.mp4 -vf "subtitles='f:\sample\dance.srt'" f:\sample\out.mp4
The parsing rules for FFmpeg filter graph are different from the rules used for other arguments.
Since 'e\sample\dance.srt' is a value of a filter graph argument, we have to add an escape character before every special character:
ffmpeg -i e:\sample\dance.mp4 -vf subtitles='e\:\\sample\\dance.srt' e:\sample\out.mp4
The subject is described in Notes on filtergraph escaping (among other places).

FFMPEG Overlay Not Found For Putting Watermark in Video

I am trying to put a logo in an rtmp stream using ffmpeg. My version of ffmpeg is ffmpeg version 4.3.1 Currently in my complex filter I have:
ffmpeg -re -i 'video.mp4' -filter_complex "tpad=start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add" -f flv rtmp://example.com/a/stream
And it works! But when I add :overlay=0:0 at the end:
ffmpeg -re -i 'video.mp4' -i image.jpeg -filter_complex "tpad=start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add:overlay=0:0" -f flv rtmp://example.com/a/stream
I get the errors:
[Parsed_tpad_0 # 0x555bc5d99f40] Option 'overlay' not found
[AVFilterGraph # 0x555bc5e7a980] Error initializing filter 'tpad' with args 'start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add:overlay=0:0'
Error initializing complex filters.
Option not found
What might I be doing wrong?
ffmpeg -re -i 'video.mp4' -i image.jpeg -filter_complex "tpad=start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add[bg];[bg][1]overlay" -f flv rtmp://example.com/a/stream
The overlay filter requires 2 inputs but you are only giving it 1.
Filters in the same linear chain are separated by commas (,) and distinct linear chains of filters are separated by semicolons (;). See FFmpeg Filtering Introduction.

Add a Text and a images to the video using ffmpeg

I have read this question in toppic:
FFMPEG overlay two video and add text
ffmpeg -i raw_video.mp4 -i watermark.png -i watermark2.png -filter_complex [0:v]drawtext=fontfile=font.ttf:text='text1':fontcolor=black#1.0:fontsize=24:x=20:y=259, drawtext=fontfile=font.ttf:text='text2':fontcolor=black#1.0:fontsize=24:x=500:y=500[text]; [text][1:v]overlay=215:0[ol1];[ol1][2:v]overlay=400:300[filtered]"-map "[filtered]" -codec:v libx264 -codec:a copy output.mp4 "
I try to using this ffmpeg but it error .
Please help me
Your first command
Problem 1: The command has a trailing " resulting in an error:
[AVFilterGraph # 0x55f096873c40] No such filter: ''
Error initializing complex filters.
Invalid argument
Remove the trailing ".
Problem 2: Missing space
Change [filtered]"-map to [filtered]" -map.
Problem 3: Filtergraph not quoted
Enclose the filtergraph in quotes: "[0:v]drawtext...overlay=400:300[filtered]"
Your second command
Problem: Unlabeled filterchain is ignored
Change enable='between(t,0,20)';[v]drawtext to enable='between(t,0,20)',drawtext and read Filtering Introduction and Filtergraph description.

Getting Exception while merging two file with ffmpeg

I am trying to merge two mp4 files using ffmpeg command. My input files are not in same encoding so they are not merge with normal command. I have use below command but got exception.
Command: -
ffmpeg -i File_1.mp4 -i File_2.mp4 -filter_complex "[0:v]setsar=1[0v];[1:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[1v];[0v][0:a][1v][1:a]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -crf 23 ffmpeg1.mp4
Exception I have got: -
[Parsed_concat_4 # 00000000067ea380] Input link in1:v0 parameters (size 720x576, SAR 1:1) do not match the corresponding
output link in0:v0 parameters (320x240, SAR 1:1)
[Parsed_concat_4 # 00000000067ea380] Failed to configure output pad on
Parsed_concat_4
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!
Please tell me what is the solution for that or any command which can help me out with merge any two mp4 file in windows using cmd.
The concat filter requires all its video inputs to have the same resolution and sample aspect ratio. The framerate and pixel format can differ, though the output may not be what you want.
So, in this command, alter the filtering of the first video input to match the second.
ffmpeg -i File_1.mp4 -i File_2.mp4 -filter_complex "[0:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[0v];[1:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[1v];[0v][0:a][1v][1:a]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -crf 23 ffmpeg1.mp4

How to get a lossless encoding with ffmpeg - libx265

I would like to convert 16 bits grayscale images in an HEVC/mkv video with the x265 encoder without loss, using ffmpeg. I use the monochrome12 profile. My first step is to convert images into yuv format:
ffmpeg -f image2 -i "C:\DATA FOLDER\images%d.png" video.yuv
And I try to convert it as a .mkv file, losslessly:
ffmpeg video.yuv video.mkv -c:v libx265 -x265-params "profile=monochrome12:crf=0:lossless=1:preset=veryslow:qp=0"
But I get
Unrecognized option '-lossless'
Error splitting the argument list : Option not found
When I don't write lossless=1 everything's right, but I don't manage to have a lossless video by this way.
thank you for your help.
It works for me if I make a few changes:
ffmpeg -i video.avi -c:v libx265 \
-x265-params "profile=monochrome12:crf=0:lossless=1:preset=veryslow:qp=0" \
video.mkv
This is like the command you've provided, except I'm using a different input format, and prepend -i to mark it as an input file.
I also put the output filename at the end, after the output options, otherwise they are not applied, and I get this warning among the output:
Trailing options were found on the commandline.
I don't think the command you gave would cause the error you get though.
libx265 will not give an error on params it doesn't recognise, but show a warning like:
[libx265 # 0x563e4520e740] Unknown option: lessloss.
I can reproduce your exact error by trying to add --lossless as a parameter to ffmpeg:
ffmpeg --lossless -i video.avi video.mkv
Unrecognized option '-lossless'.
Error splitting the argument list: Option not found

Resources