It´s possible to save a video on React-Native using cameraRoll, for images with saveImageWithTag() it´s easy but i can´t found documentation for videos.
It is very easy to save a video to CameraRoll, I did it with the following line of code.
saveVideoToCameraRoll = async (uri) => {
await CameraRoll.saveToCameraRoll(uri, 'video')
}
NB: Obviously this function expects a uri or filePath of your video.
Related
How I can remove tiktok video logo/watermark using FFmpeg? Like most sites are doing e.g https://ssstik.io/en
I tried to remove the logo using delogo filter https://github.com/protonemedia/laravel-ffmpeg but it leaves a blur effect in the video while the above site logo removal is clean, with no blurry effect.
Sample code:
$video = FFMpeg::open('public/tiktok/video2.mp4');
$video->addFilter(function ($filters) use ($bottom_coordinates) {
$filters->custom( 'delogo=x=10:y=10:w=150:h=77');
})
->export()
->inFormat(new \FFMpeg\Format\Video\X264)
->toDisk('public')
->save('7118695488282447131_delogo.mp4');
Any help?
Thanks in advance.
i'm showing images in my flutter app using
Image.network('link...')
I want to show to the user how old is that image, using the exif, showing the modification/creation time of that file, or another way around
final ByteData bytes = await rootBundle.load('assets/jpg/your_image.jpg');
var list = bytes.buffer.asUint8List();
final data = await readExifFromBytes(list);
For more, read exif
I am currently using FFImageLoading package to do caching etc to show on the ui. I am unsure whether FFImageLoading have function to resize the image itself so i can save it and send over the internet.
It's as easy as:
var stream = await ImageService.Instance.LoadFile("someimage.png")
.DownSample(width: 200)
.AsPNGStreamAsync();
I'm trying to extract image frames from a short clip of an IP cam. Specifically this clip.
http://db.tt/GQwu0nZ8
So, I'm trying to extract that frames with ffmpeg with this.
ffmpeg -i M00001.jpg -vcodec mjpeg -f image2 image%03d.jpg
I'm just getting only the first frame of the clip. How can I get the rest of frames? Can I use another tool to get that images?
Thank you
This may be too much but here's a short javascript program for Node.js https://nodejs.org/ that will strip all the readable frames out and save them as separate sequentially numbered jpg files in the current directory. Beware, even a short video clip can generate thousands of frames and the V8 javascript engine that Node uses is really fast so I recommend closing your file browser because it will hog resources trying to keep up.
If the video file is too large to create a buffer for, Node will issue an error and exit.
In that case the easiest thing to do would be to split the file into chunks with your shell utilities or a program like HexEdit. http://www.hexedit.com/
Rewriting this code to process the file asynchronously would fix that issue but writing asynchronous code still gives me anxiety.
var orgFile=process.cwd()+"/"+process.argv[2]; //Grab the video filename from the command line
var fs = require("fs"); //Load the filesystem module
var stats = fs.statSync(orgFile);//Get stats of video file
var fileSizeInBytes = stats["size"];//Get video file size from stats
var fdata=new Buffer(fileSizeInBytes);//Create a new buffer to hold the video data
var i=0;
var fStart=0;
var fStop=0;
var fCount=0;
fdata=fs.readFileSync(orgFile);//Read the video file into the buffer
//This section looks for the markers at the begining and end of each jpg image
//records their positions and then writes them as separate files.
while (i<fileSizeInBytes){
if (fdata[i]==0xFF){
//console.log("Found FF at "+i.toString);
if (fdata[i+1]==0xD8){
//console.log("Found D8 at "+(i+1).toString);
if (fdata[i+2]==0xFF){
//console.log("Found FF at "+(i+2).toString);
fStart=i;
}
}
}
if (fStart>0){
if (fdata[i]==0xFF){
if(fdata[i+1]==0xD9){
fStop=i+1;
}
}
if (fStart>0){
if (fStop>0){
fCount++;
fs.writeFileSync(orgFile+"."+fCount.toString()+".jpg",fdata.slice(fStart,fStop));
console.log (orgFile+"."+fCount.toString()+".jpg");
fStart=0;
fStop=0;
}
}
}
i++;
}
console.log ("Wrote "+fCount.toString()+" frames.");
If you save the above code as mjpeg_parse.js an invocation example would be:
Node mjepeg_parse.js videofile.avi
The command with ffmpeg works fine, but you need to specify mjpeg video as an input file. If M00001.jpg is a single jpg image, then you will get only one (the same) output image.
i am trying to load images from facebook. if a user has set a profile picture, then the picture is a jpg, however, if a user has not set one, then the picture is a stub image in gif format. i know that wp7 does not support displaying gif images (out of the box). is there any way to detect if the final picture is a gif or not?
for example, i make a BitmapImage like this:
BitmapImage img = new BitmapImage(new Uri("https://graph.facebook.com/userid1/picture"))
for this uri, the user does not have a profile picture. so i get taken to a stub gif image at https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/yo/r/UlIqmHJn-SK.gif.
if a user does have an image, then i request it as follows.
BitmapImage img = new BitmapImage(new Uri("https://graph.facebook.com/userid2/picture"))
for the above url i get taken to a url like this: https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/000000_1621037713_00000000_q.jpg
my question is then, once i get the BitmapImage object, img, can i determine if this is a JPG or GIF? can i convert it to a JPG if it is a gif?
i looked at some related questions, but the API discussed loaded the image asynchronously, which is not what i wanted at the moment. furthermore, there was poor documentation.
any help is appreciated.
nevermind, i followed the instructions here: Display GIF in a WP7 application with Silverlight. the user gave an excellent walk through.
what you need to do before you do what this user suggested is to download the source code from codeplex.
then you need to download BitMiracle's JPEG library from http://bitmiracle.com/libjpeg/.
go ahead and go into the /src/ImageTools directory and open up ImageTools.Phone.sln. add the ImageTools.IO.Jpeg.Phone project to the solution.
when you build the solution it will complain about not finding BitMiracle's JPEG dll, go ahead and reference that DLL for the Jpeg project. build again, and it should work.
First download the image(any) using Httprequest or Webclient and then convert to jpg or png from gif(if it is gif) in the following way.
GifDecoder gd = new GifDecoder();
ImageTools.ExtendedImage img = new ImageTools.ExtendedImage();
gd.Decode(img, stream); //stream means image stream
PngEncoder png = new PngEncoder();
png.Encode(img, isoFileStreamdownload); //isoFileStreamdownload means stream, which is used to save image in image file like(image.png))
using ImageTools.dll, ImageTools.IO.Gif.dll,ImageTools.IO.Png.dll (Images Tools)
I think it helps to you