How drawtext on video using flutter ffmpeg 0.3.0 - flutter

Hello I want to add text and image on video but my command not working with flutter ffmpeg 0.3.0
Here is my commands :
Working command code with only logo:
FlutterFFmpeg flutterFFmpeg = new FlutterFFmpeg();
flutterFFmpeg.execute('-i $video -i $logo -filter_complex "overlay=20:20" $output').then((rc) =>
print("FFmpeg process exited with rc $rc"));
Not Working command code with logo and text:
FlutterFFmpeg flutterFFmpeg = new FlutterFFmpeg();
flutterFFmpeg.execute('-i $video -i $logo -filter_complex "overlay=20:20" drawtext=text=mytext $output').then((rc) =>
print("FFmpeg process exited with rc $rc"));
Please help me

-i $video -i watermark.png -filter_complex "[0:v][1:v] overlay=5:2, drawtext=fontsize=20:fontcolor=white:fontfile=simple.ttf:text=hello" out.mp4
execute this command to add watermark with text in a flutter.
I was an error from fontfile don't forget to add fontfile correct path

Related

How to concat two videos and play it in flutter

var output =
"${rootPath}_${DateTime.now().microsecondsSinceEpoch}_M3.mp4";
String commandToExecute = '-i $latest -i $compress -filter_complex \'[0:0][1:0]concat=n=2:v=1:a=0[out]\' -map \'[out]\' $output';
await ffmpeg.execute(commandToExecute).then((rc) {
if (rc == 0) {
latest = output;
}
});
Tried this process but rc always shows 1 for android. how to solve it?

flutter package for trim audio

I am trying to create a flutter app with trim audio. For that, I am looking for a library to trim a audio like video_trimmer.
I have tried the audiocutter package. But the package is old and it's use flutter_ffmpeg package.
But In my app used ffmpeg_kit_flutter package for video trimming. So I can't use audiocutter package.
Thanks in Advance
You can use following FFmpegKit command to cut audio.
double start = 1;
double end = 5;
var cmd = "-y -i \"$path\" -vn -ss $start -to $end -ar 16k -ac 2 -b:a 96k -acodec copy $outPath";
FFmpegKit.executeAsync(cmd, (session) async {
final returnCode = await session.getReturnCode();
print("returnCode $returnCode");
});

Merging Audio file with Video file in Flutter

I am working on an app which has similar functionality like Instagram reels. I want to know how do I merge a song(audio) while recording the video and then store them both as a video.
We will do using flutter_ffmpeg package.
create a command like this.
command = "-y -i $videoPath -i $audioPath -map 0:v -map 1:a -c:v copy "
"-shortest $savedFileLocation"
to execute command using
final FlutterFFmpeg _flutterFFmpeg = FlutterFFmpeg();
_flutterFFmpeg.execute(command.string).then((rc) {
statusCode = rc;
print("FFmpeg process exited with rc $rc");
return statusCode;
});

Trim the video to 5 minutes

I am working on a demo project on which I have to get only 5 minutes video is there any way to trim the video to 5 minutes only. Currently, I am using FFmpeg flutter to get the video file and its metadata.
You can use any ffmpeg command in execute() method of flutter-ffmpeg package, to trim first 5 minutes of video
import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';
....
final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
_flutterFFmpeg.execute("-ss 00:00:00 -i input.mp4 -to 00:05:00 -c copy output.mp4").then((rc) => print("FFmpeg process exited with rc $rc"));
You can use following command code to split a video.
final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
_flutterFFmpeg
.execute(
'-i videoplayback.mp4 -ss 00:00:50 -t 00:01:30 -c copy smallfile1.mp4')
.then((value) {
print('Got value ');
}).catchError((error) {
print('Error');
});
Start time is -ss 00:00:50 end time is 00:01:30
For getting video information you may can try following code.
fFmpeg.execute('-i video.mp4 -f null /dev/null').then((value) {
print('Got value ');
}).catchError((error) {
print('Error');
});

Download file using Wget yammer export data

I create console application that export data from yammer to local using wget
third party tool
and this is the reference
https://developer.yammer.com/docs/data-export-api
the function that execute script:
internal static bool ExecuteScript()
{
try
{
ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
Process p = new Process();
startInfo.RedirectStandardInput = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
p = Process.Start(startInfo);
p.StandardInput.WriteLine("wget -O export.zip -t 1 --header \"Authorization: Bearer %Token%\" -ca-certificate cacert.pem https://www.yammer.com/api/v1/export?since=2016-02-09T00:00:00z");
p.StandardInput.WriteLine(#"exit");
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
p.Close();
Console.WriteLine("Error:" + error);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
i replace %Token% with my token
but when run the code it cut off download and create export.zip file 0KB
it's not download complete file
it show this message in console
Console application output
although i take this script in batch file and run it from cmd in same path it download complete file
notes:
1- I add Wget path to Path Environment
2- I'm using windows 10
3- I'm using VS 2013
i discover the issue
p.StandardInput.WriteLine("wget -O export.zip -t 1 --header \"Authorization: Bearer <Access Token>\" --ca-certificate=cacert.pem cacert.pem https://www.yammer.com/api/v1/export?since=2016-02-09T00:00:00z");