I want to create a video from list of images which is stored in list image;
Which are selected by user from gallery.
Please help me I spend a month in this searching but found nothing.
I think or search a lot how to pass this list to ffmpeg to create video but fail to understand.
Now I generate a solution to create video from image after that copy each photo 1 by 1 to that video to get final result. Please tell me how can I copy image to video like.
String commandToExecute = '-t 1 -i ${img[0].path} - ${video.mp4}';
then i want to copy other image to same video
for(int i=1;i<img.lenght(); i++){
String cmd='-i ${img[].path} -c copy ${video.mp4}';
}
In this way I want to create video with all images which user select.
But I cannot found any result with this code
Related
I have a feature to implement in Flutter. I have to record user video and fetch audio from that for next level verification. Does anyone have any idea about this.
Thanks in advance.
I assume you are trying to extract audio only from Video, you can achive this by using the ffmpeg package.
Import this package in your project add the following lines in your android\build.gradle
ext.flutterFFmpegPackage = 'full'
flutter_ffmpeg provides eight packages that include different sets of external libraries. These packages are named according to the external libraries included in them. From documentation you can see which libraries are enabled in each package. And you can use according to your need, so if you need to change full to specific one you can do this but here i am using full to make your work done.
With below code snippet you can extract audio from video
final FlutterFFmpeg FFmpeg = FlutterFFmpeg();
FFmpeg.execute(
"-i /storage/emulated/0/download/Test_video.mp4 -map 0:a -acodec libmp3lame /storage/emulated/0/download/test3.mp3").then((rc) =>
{
print("FFmpeg process exited with rc $rc.")
}
Print statement should return 0 on success, Also i am using testvideo from my own storage you need to change this according to your storage location.
I am using the multiple file picker package on pub.dev, the link is below https://pub.dev/packages/multi_image_picker in conjunction with the image cropper package by Yalantis
https://pub.dev/packages/image_cropper
to let my user pick multiple images and then crop them at will.
I am using this code to convert my asset into a file and feed it into the cropper. And it works.
final temp = await Directory.systemTemp.createTemp();
final data = await finalList[index].getByteData();
File failo = await File('${temp.path}/img').writeAsBytes(
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
print("The path is ${temp.path}");
File croppedFailo = await ImageCropper.cropImage(
sourcePath: failo.path,
androidUiSettings: AndroidUiSettings(toolbarTitle: "My App"),
);
The tricky bit is to convert it back to an asset so that i can replace the old uncropped asset with this new cropped one..I read through the Asset documentation of the package and I tried this but it made my app crash
Asset croppedPic = new Asset(
croppedFailo.path,
DateTime.now().millisecondsSinceEpoch.toString(),
300,
300,
);
finalList.replaceRange(index, index + 1, [croppedPic]);
EDIT: When i say "asset", i am not referring to images i manually added to the assets/images folder in the app. The multi image picker plugin has a file- type called asset in which it returns images. That is the type to which i want to convert my file back into.
Never mind. I figured it's too unnecessarily complicated to do that. So, i instead just reformatted my entire code to handle images as files instead of assets. And, it actually made my life a lot simpler coz files give you more versatility and less problems than assets.
I have been really cracking my head trying to write and read png files into a folder in Windows Phone 8. From few blogs sites and codeplex i found that the there is an extension to the WritableBitmap Class which provides few extra functionalities. ImageTools has PNG encoder and decoder. But I really cant find examples to use them.
What Im trying to achieve here is to create a folder called page and then in it a file called Ink File. I want to convert the bitmap to a PNG and store it there. The bitmap is created from the strokes drawn on a canvas. The class ImageTools provides a function called ToImage to convert the strokes from the canvas to image.
For storing
ExtendedImage myImage = InkCanvas.ToImage();
var encoder = new PngEncoder();
var dataFolder = await local.CreateFolderAsync("Page", CreationCollisionOption.OpenIfExists);
StorageFile Ink_File = await dataFolder.CreateFileAsync("InkFile", CreationCollisionOption.ReplaceExisting);
using (var stream = await Ink_File.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite))
{
using (var s = await Ink_File.OpenStreamForWriteAsync())
{
encoder.Encode(myImage, s);
await s.FlushAsync();
s.Close();
}
}
Is this a correct method? I receive some null exceptions for this. How do i find if the image is saved as png. How is this image saved? Is it encoded and saved in a file or is it saved as a png itsef. And how do we read this back?
I have checked out this, this , this and lot more like this.
I'm developing app for WP8
I have used the PNG Writer Library found in ToolStack and it works :)
I am almost done creating my sound cloud streaming custom player, but I would like the option to add the title and artist of the song that is currently playing.
Right now I have this: http://hellkeepers.com/music/examples/sc-player-minimal.html
But I cannot seem to figure out where to find the current track information.
to get an image and the title you can use this code:
//get element by id from your iframe
var widget = SC.Widget(document.getElementById('soundcloud_widget'));
widget.getCurrentSound(function(music){
artwork_url = music.artwork_url.replace('-large', '-t200x200');
$('#song1').css('background', 'url(\"'+artwork_url+'\") ');
//write the title in a div with the id "title"
document.getElementById('title').innerHTML = music.title;
});
normaly you get a link with "-large" at the end and the size is 100x100. If you want other sizes you have to change the end with ".replace" like I did. A list with available sizes can you find here:
https://developers.soundcloud.com/docs/api/reference#tracks (my size 200x200 is not listed but works. Maybe there are more sizes like every hundred px.)
with:
widget.getDuration(function(duration) {
alert(duration);
}
you have the length of the song in milliseconds
with:
widget.getPosition(function(position) {
alert(position);
}
you have the actual poisition of the song in milliseconds. you have to run a loop to get every second the actual time. And probably you have to calculate milliseconds into seconds and minutes.
Late but better then never my answer :D
I am having a problem when creating an avi file using Matlab. My aim is to use an edge filter on an entire video and save the file as an avi. The filter works fine, my problem is the writing of the avi file.
My code:
vidFile = VideoReader('video.avi');
edgeMov = avifile('edges','fps',30);
for i = 1:vidFile.numberofframes
frameI = read(vidFile,i);
frameIgray = rgb2gray(frameI);
edgeI = edge(frameIgray,'canny',0.6);
edgeIuint8 = im2uint8(edgeI);
edgeIuint8(:,:,2) = edgeIuint8(:,:,1);
edgeIuint8(:,:,3) = edgeIuint8(:,:,1);
edgeMov = addframe(edgeMov,edgeIuint8);
end
edgeMov = close(edgeMov)
When the loop finishes and the avifile is closed, I go to play the video and it says "Windows Media Player encountered a problem while playing this file". I've also tried, without success, Media Player Classic and VLC which lead me to believe that the problem must be the file itself. Using GSpot I checked the file and it said that the AVI header is corrupt.
Retrying the loop again returned exactly the same problem. What's confusing me is when I run the loop for a smaller number of frames, 30 for example, the video writes fine and I can watch it. The size of the video I am trying to convert is in excess of 1000 frames so I don't know if size is a problem?
Any help would be greatly appreciated, thank you.
I've used the following to create AVI
edgeMov = avifile('video.avi','compression','Indeo5','fps',15,'quality',95);
Give it a try.