Flutter ffmpeg_kit_flutter not able to DrawText over video - ios

I am Trying to overlay text over the Video using ffmpeg dependency.
i have tried many options, but my most recent commands are as follows,
await FFmpegKit.execute(
'-i $path -vf "drawtext="fontfile=TiktokFont.ttf:text=\'Stack Overflow\':fontcolor=white:fontsize=24:box=1:boxcolor=black#0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2"" -codec:a copy "$outputPath"')
My pubspec Dependency:
ffmpeg_kit_flutter: ^4.5.1
But the result is always like this.
Error : No such filter: 'drawtext'
Solutions Tried:
Changed the Font.tff
Set Font in the configuration file for ffmpeg
changed the command, removed the box
replaced -vf with -filter_complex
All of them give me same result as follows screenshot. [Logs]

ffmpeg_kit_flutter installs the https package by default. Try using the full package instead.
dependencies:
ffmpeg_kit_flutter_full: ^4.5.1
You can see all the available packages here and detailed installation instructions here.

Related

textclips in moviepy on google colab (imagemagick error)

I'm trying to add text to a moviepy video, but I'm having trouble getting imagemagick to work on google colab.
The code:
!apt install imagemagick
from moviepy.editor import TextClip
txtClip = TextClip('Cool effect',color='white',
font="Amiri-Bold", kerning = 5, fontsize=100)
The error:
OSError: MoviePy Error: creation of None failed because
of the following error:
[Errno 2] No such file or directory: 'unset': 'unset'.
.This error can be due to the fact that ImageMagick is
not installed on your computer, or (for Windows users)
that you didn't specify the path to the ImageMagick
binary in file conf.py, or that the path you specified
is incorrect
research:
Not able to add Text Clip in Moviepy. Getting error related to Imagemagic
Getting error about ImageMagick With Python/MoviePy when I try add text clip
Attempt at resolving the issue:
Based on the error message, I started looking for the conf.py file. I ran
!find / -type d -name "conf.py" but none of the files returned seemed to be under the subdirectory of imagemagick.
I also modified the policy.xml file under /etc/ImageMagick-6 by commenting out the line <!--<policy domain="path" rights="none" pattern="#*"/>--> but to no avail seemingly.
Any ideas??
I had the same issue. Check if this work for you: Install with:
!apt install
imagemagick
Then to fix the issue that it thinks ImageMagick is not installed use this:
!cat /etc/ImageMagick-6/policy.xml | sed 's/none/read,write/g'>
/etc/ImageMagick-6/policy.xml

ImageMagic gives ' delegate failed `'ufraw-batch' '

{ Error: Command failed: identify: delegate failed `'ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i'' # error/delegate.c/InvokeDelegate/1919.
identify: unable to open image `/tmp/magick-53080Z_JGYvtuPOl8.ppm': No such file or directory # error/blob.c/OpenBlob/2841.
I got an issue while working with ImageMagick in my node application I did the search but can't get the proper solution for my problem.
Edit: ufraw is no longer maintained, so use at your own risk and see dcraw alternative lower down.
You need to install 'ufraw-batch'
sudo apt-get install ufraw-batch
If this does not work, as it did for me. I got a "Segmentation fault (core dumped)"
This seems to be common problem with ufraw: https://sourceforge.net/p/ufraw/bugs/
It does not seem to get update much anymore, at least not in the main repos.
Converting RAW image into other types of image you can use DCRaw (it is also used by UFRaw).
Here is an example to convert a .cr2 image to a .png:
dcraw -c -w "./IMG_1.CR2" | pnmtopng > "./IMG_1.png";
Macos:
brew install ufraw
Solved it for me

Avconv and "Unable to find a suitable output format" error

Hi I want to add some text on a .mp4.
I'm trying this :
shell_exec("avconv -i input.mp4 drawtext=\"fontfile=OpenSans-Italic.ttf: text='Test Text'\" output.mp4").
But I get
Unable to find a suitable output format for
'drawtext=fontfile=OpenSans-Italic.ttf: text='Test Text''
drawtext=fontfile=OpenSans-Italic.ttf: text='Test Text': Invalid
argument
Any idea of what's going on ?
There is mistake with your argument drawtext. It is a filter but you need -vf before it so libav can understand what it is. Overall your command should be:
shell_exec("avconv -i input.mp4 -vf drawtext=\"fontfile=OpenSans-Italic.ttf: text='Test Text'\" output.mp4")
This looks like php so I would also suggest you to check:
Read/write permissions,
Path of OpenSans-Italic.ttf file,
Execution path vs file path
Whether libav was compiled with --enable-libfreetype option (which is required for drawtext filter)
Source: https://libav.org/documentation/libavfilter.html#drawtext

how to convert Pdf to image via imagemagick command?

I am using following environment:
Ubunut : 11.0 (virtual machine)
Imagemagick : ImageMagick-6.9.3-7
I have execut following command:
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
ls
cd ImageMagick<version number here>/
./configure
make clean
make
sudo make install
ldconfig /usr/local/lib
After executing below command:
make check
40 test case 39 pass only 1 is fail (FAIL: tests/wandtest.tap 1)
Now i want to convert pdf file to jpg via command:
convert test.pdf test.jpg
convert: no decode delegate for this image format PNG' # error/constitute.c/ReadImage/501.
convert: no images definedtest.jpg' # error/convert.c/ConvertImageCommand/3252
convert test.pdf test.png
convert: no decode delegate for this image format PNG' # error/constitute.c/ReadImage/501.
convert: no images definedtest.png' # error/convert.c/ConvertImageCommand/3252.
anyone can suggest me how can i do ?
ImageMagick uses assorted external libraries to do its dirty work as far as input and output handling goes for various formats. In your case:
For reading PDFs, you need to have Ghostscript installed. Also it needs to be in your path as gs in order to work, so don't use that for some other shell alias. For more details see: https://superuser.com/q/819277/33767
For writing PNGs you'll need libpng.
Once those things are on your system (and in the case you compiled IM yourself, on your system at the time of compile) you should be golden.
It may be that the issue is not with the writing but with the reading of the PDF itself.
Check the ImageMagick policy.xml.
sudo nano /etc/ImageMagick-6/policy.xml
Find the PDF and change to this:
<policy domain="coder" rights="read|write" pattern="PDF" />
This solved for me.
Same problem. Solved it with:
apt-get -y install ghostscript

Markdown to PDF using Pandoc since Xetex Deprecation

On my MacBook (OSX Mountain Lion), I used to use this Pandoc command to convert Markdown to PDF:
$ markdown2pdf -N -o pandoc_output.pdf --xetex --toc --template=mytemplate.tex myfile.md
But markdown2pdf no longer works, and --xetex option in markdown2pdf -N -o ../../Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate-headers-garamond_date.tex is deprecated.
If I do this:
$ pandoc -N -o Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate.tex myfile.md
I get this:
pandoc: unrecognized option `--xetex'
But if I take out --xetex and do this:
$ pandoc -N -o Desktop/pandoc_output.pdf --toc --template=mytemplate.tex myfile.md
then I get this:
pandoc: Error producing PDF from TeX source.
! Package hyperref Error: Wrong driver option `xetex',
(hyperref) because XeTeX is not detected.
See the hyperref package documentation for explanation.
Type H <return> for immediate help.
...
l.3925 \ProcessKeyvalOptions{Hyp}
What's the solution?
Try --latex-engine=xelatex instead of --xetex
The prior answers to this question were helpful to me, as I had installed pandoc a couple years ago, but never Tex Live. Consequently I had no idea if I had installed it correctly, so putting in the entire path helped me to see that it was working, as follows:
pandoc --latex-engine=/usr/local/texlive/2012basic/bin/universal-darwin/xelatex
This is the default install location for the BasicTex setup which you download from the Pandoc install page.
I had also forgotten about using pandoc -D Latex >my-latex-template.tex to generate a template. After giving a .tex template instead of my .html one (which caused a 'you don't have BEGIN {' error) , I got .PDF: In other words, the default template worked.
Also, I had inaccurately entered -t pdf (not shown above) to set pdf as an output format, but this was not correct. The output format is Latex, which is then translated to PDF. It is not necessary to specify an output format with the dash -t option.
I hope this record of my minor stumbles saves someone some time.
See the pandoc User's Guide (or man page) for the --latex-engine option.

Resources