I am Using FFMPEG With C# , And I want to add a water mark to a video , so I store the position of the user click in the media player and then Use the FFMPEG Command :
-i input.mp4 -vf "drawtext="Roboto-Regular.ttf":text='Stack Overflow':fontcolor=white:fontsize=24:box=1:boxcolor=black#0.5:boxborderw=5:x=300:y=100" -codec:a copy "ouput.mp4"
but this is not working , Any Solutions ?
Try this:
-i input.mp4 -vf "drawtext=Roboto-Regular.ttf:text='Stack Overflow':fontcolor=white:fontsize=24:box=1:boxcolor=black#0.5:boxborderw=5:x=300:y=100" -codec:a copy "output.mp4"
Note that the double-quotes have been removed from the font file name. In my testing this worked fine on Windows.
Related
I'm using some X11 bindings to query some window information and later pass it to FFmpeg. FFmpeg expects a "window ID" given in hexadecimal notation.
This notation seems somewhat standard, as it is returned by programs like xwininfo or wmctrl. I haven't found much information about it, but it seems to just be the hexadecimal representation of the window pointer? If I take the ID string given by these programs and give it to FFmpeg, it is able to capture the window correctly:
$ xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x2800014 "Desktop — Plasma"
$ ffmpeg -f x11grab -window_id 0x2800014 -i :0+0,0 -f apng -vframes 1 out.png
# works fine
However, if I try listing all the windows in code:
var root = Window.None;
var parent = Window.None;
Xlib.XQueryTree(_display, Xlib.XDefaultRootWindow(_display), ref root, ref parent, out var children);
var ids = children
.Select(ptr => $"0x{(ulong) ptr:x}")
.ToArray();
I don't see 0x2800014 in the results (even disregardingleading zeroes), and if I try running FFmpeg on one of those results, it fails terribly:
$ ffmpeg -f x11grab -window_id 0x4400003 -i :0+0,0 -f apng -vframes 1
# snipped for brevity
Trailing option(s) found in the command: may be ignored.
[x11grab # 0x55b811a8da40] Cannot get the image data event_error: response_type:0 error_code:8 sequence:10 resource_id:167772160 minor_code:4 major_code:130.
[x11grab # 0x55b811a8da40] Continuing without shared memory.
[x11grab # 0x55b811a8da40] Cannot get the image data event_error: response_type:0 error_code:8 sequence:11 resource_id:71303171 minor_code:0 major_code:73.
Input #0, x11grab, from ':0+0,0':
Duration: N/A, bitrate: 38361 kb/s
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 200x200, 38361 kb/s, 29.97 fps, 1000k tbr, 1000k tbn
At least one output file must be specified
So I must conclude my guess that they are hex pointers is incorrect, or that the Window type is not the pointer itself, but then the question stands, how can I get the actual window IDs so I can pass them to FFmpeg?
I must have missed the documentation. XQueryTree returns only children windows (direct descendants), not all descendants. You have to recursively call it on the returned children array to gather the entire tree.
I want to create a video with ffmpeg. There are background image(450pxx800px) and video(unknown sizes). I want scale to video 450x800 and put the image video background. I try this code but when finish job, video create without audio. what must i do?
ffmpeg -loop 1 -i C:\Users\drt\Desktop\media\background\bg4.png -vf "movie='C\:\\Users\\drt\\Desktop\\media\\fX4I0jW8_fX4I0jW8.mp4',scale=450:800:force_original_aspect_ratio=1,pad=450:800:0:264:color=black#0,setsar=1[inner];[in][inner] overlay=0:0[out]" -ss 00:00:00.000 -to 00:00:15.000 -y C:\Users\drt\Desktop\media\2q4pyZpSCE7syzJMj.mp4
You need to map the output streams. Also, no need to use the movie filter: that method is from a billion years ago.
ffmpeg -y -i C:\Users\drt\Desktop\media\fX4I0jW8_fX4I0jW8.mp4 -i C:\Users\drt\Desktop\media\background\bg4.png -filter_complex "[1:v]scale=450:800:force_original_aspect_ratio=1,pad=450:800:0:264:color=black#0,setsar=1[inner];[0:v][inner]overlay=0:0[video]" -map "[video]" -map 0:a -c:a copy -to 00:00:15.000 C:\Users\drt\Desktop\media\2q4pyZpSCE7syzJMj.mp4
I am having an issue with the spaces in my command. I am trying to run the cmd prompt and execute a program that takes command line arguments. I need the cmd window to remain open after the process is finished executing.
I managed to get it working in another section of code, but this time i am almost sure it has to do with the spaces in the path of the argument. If i use a path with no spaces, it works fine. I tried to escape the quotes, but either i am doing it incorrectly, or escaping the quotes do not work.
Basically, I need to make the line below work with spaces and keep the cmd window open after the execution...
Dim ps As Process = System.Diagnostics.Process.Start("cmd /k", "C:\common\tools\tap.exe -f flash C:\Users\test project\Desktop\image.signed")
I'm know the space between "test" and "project" is the issue, but i haven't been able to get around it.
Thanks in advance for your help.
Wrap the path in double-quotes, like this:
"C:\common\tools\tap.exe -f flash ""C:\Users\test project\Desktop\image.signed"""
Giving you:
Dim ps As Process = System.Diagnostics.Process.Start ("cmd /k", "C:\common\tools\tap.exe -f flash ""C:\Users\test project\Desktop\image.signed""")
I have created a .NET C# project that I have commented using blocks similar to ///<summary>A summary...</summary> that I would like to document using Doxygen. I have set up Doxygen and it runs generating a some 100 .tex-files and a Makefile.
As I have understood, the Makefile is the key to generating the documentation as a PDF, however I do not get it to work.
I'm using a Mac to do the LaTeX and Doxygen bit by writing make -f Makefile in the Terminal when I am in the Doxygen LaTeX output directory.
all: refman.pdf
pdf: refman.pdf
refman.pdf: clean refman.tex
pdflatex refman
makeindex refman.idx
pdflatex refman
latex_count=5 ; \
while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\
do \
echo "Rerunning latex...." ;\
pdflatex refman ;\
latex_count=`expr $$latex_count - 1` ;\
done
clean:
rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf
When running, i get the following message:
MacBook-Pro-13:latex sehlstrom$ make
rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf
make: *** No rule to make target `refman.tex', needed by `refman.pdf'. Stop.
How can I get the Makefil thing work?
refman.tex is supposed to be created by Doxygen. I just tested with my installed version, doxygen 1.7.2, and it created a refman.tex.
Make sure you aren't setting any option that says this is a component of a larger project that shouldn't have its own index.
I have been using ffmpeg to convert a sequence of jpegs to a video using the following syntax
ffmpeg -f image2 -i frame%d.jpg -vcodec mpeg4 -b 800k video.avi
it works a treat, however if the filenames dont start at 0 and then pursue in accending order I get weird results. for example the first file in the directory is frame1 and last file is fram 61.I should point out that im always using a list of jpegs which accend in incrental order. for example a list of files called frame1, fram2, fram3 etc.
the following works fine
frame1.jpg to frame9.jpg
frame1.jpg to frame10.jpg
frame2.jpg to frame8.jpg
frame2.jpg to frame10.jpg
frame2.jpg to frame11.jpg
frame2.jpg to frame17.jpg
frame2.jpg to frame20.jpg
frame2.jpg to frame30.jpg
frame2.jpg to frame61.jpg
the following doesnt work
26 to 57 fail
11 to 61 fail
10 to 61 fail
20 to 61 fail
24 to 61 fail
Can I modify the arguments for ffmpeg so that it will make the video regardless of the filenames? (frame%d)
The only way I got this to work was by naming frames files with a constant fixed width for frame counters. If you are taking frames from webcams check if that could be done by the webcam itself, otherwise, you'll have to rename it yourself. You may develop a Windows Service that use a FileWatcher class in C# that "listens" for a folder to be writted with a frame and then rename it to another folder with the beforemention format. This worked for me.
frame01.jpg
frame02.jpg
...
frame10.jpg
frame11.jpg
...
frame61.jpg
Then using this:
ffmpeg.exe -r 1 -f image2 -i frame%02d.jpg -r 16 -vcodec mpeg4 -b 800k -y video.avi
-i frame%02d.jpg: indicates 2 digits for frame counter
I added -r 1 and -r 16 as optional framerates that I test to have worked for me.
You could rename all jpeg files so the numbering always starts at zero and there are no gaps.