Convert GIF into video - xCode 8 and swift 3 - converters

Does anyone know a good library for swift that can convert GIF or array of images into a video? Currently I'm using this library HJImagesToVideo to do the job, but it's taking very long time to convert a very short GIF animation

Related

Upload a picture to generate a video with special effects

I am stucked by a video processing feature, Specifically, upload an image and then generate a video based on various video templates.
Here are the video templates:
http://video-static.biku8.com/data/video/template/3286012076458048/7437ab55-2e83-4a36-9046-5708fcddf4c1.mp4
http://video-static.biku8.com/data/video/template/3274256089907264/ae8fa3f7-6c9c-45ca-810f-48db92cc14cb.mp4
http://video-static.biku8.com/data/video/template/3213894231425088/bf107d439b9043a58c1ea0ba26f811db_template.mp4
...
As shown in the video templates above, I just need to upload a photo to generate a great video.
My question
What is the specific idea for implementing this video?
Which third-party libraries are needed? (ffmpeg, opencv)
PS: I am using dlib and opencv for face recognition. I can generate face image, but I don't know how to insert face image into the correct position of these template videos.
I would suggest you to follow the below 3 steps
Load the template video by opencv, you can access the video frame by frame
Modify each frame, one by one.
Save frame to video stream writer
Regarding step 2, actually, you must copy the uploaded image to the each frame by a mask (the pixel from source image would be copied to destination image if its coordinate on the mask is non-black). The mask could be defined by a list of points OR by an image. You should pre-define a mask for each frame in a file. Then load the mask for each frame and copy.
How to read video, save video OpenCV read-write Video
How to insert image to another image Copy non rectangular ROI
Generating videos like them are all not easy tasks. I recommend to use Adobe After Effects or other video creating software (with some scripts and actions) if you don't need to generate it by a single program or program language.
Then, I answer them below when you need to generate it by programatically.
For the first one, you should recognize faces and bones. So you should use OpenCV. ( I recommend to use tools like OpenFrameworks or TouchDesigner and so on. )
For the second one, I don't know what you exactly want, but if you want to recognize the position of the bottle dynamically, you have to use deep learning or other way to detect it. Then you may need TensorFlow or OpenCV. ( If you just want to merge layers, you can use ffmpeg etc. )
For the last one, you should split the video frame into the boxes, then you have to control. I think there are many ways to implement this. I may use OpenFrameworks, TouchDesigner, vvvv, or Processing.
I think using ffmpeg for them is not recommended. This tool is not the best for generating complicated video. But ffmpeg will do good, for example if you just merge two videos with alpha.

FFmpeg image sequence to video with variable image durations

I have been looking for a way to convert a sequence of PNGs to a video. There are ways to do that using the CONCAT function within FFmpeg and using a script.
The problem is that I want to show certain images longer than others. And I need it to be accurate. I can set a duration (in seconds) in the script file. But I need it to be frame-accurate. So far I have not been successful.
This is what I want to make:
Quicktime video with transparancy (Prores4444 or other codec that supports transparancy + alpha channel)
25fps
This is what I have: [ TimecodeIn - TimecodeOut in destination video ]
img001.png [0:00:05:10 - 0:00:07:24]
img002.png [0:00:09:02 - 0:00:12:11]
img003.png [0:00:15:00 - 0:00:17:20]
...
img120.png [0:17:03:11 - 0:17:07:01]
Of course this is not the format of the script file. Just an idea about what kind of data I am dealing with. The PNG-imagefiles are subtitles I generate elsewhere in my application. I would like to be able to export the subtitles as a transparent movie that I can easily import in my video editing software.
I also have been thinking of using blank transparent images I will use as spacers, between the actual subtitle images.
After looking around I think this might help:
On the FFMPEG site they explain about making a timed slideshow
In the Concat demuxer section they talk about making a slideshow, based on a text file, with references to the image files and the duration of the image.
So, I create all the PNG images I need. These images have the subtitle text. Each image holds one subtitle page.
For the moments I want to hide the subtitle, I use a blank PNG.
I generate a text file as explained on the FFMPEG website.
This text file will reference to all the PNGs. For the duration I just calculate the outcue - incue. Easy... I think...

Filter/find animated GIFs in Windows

I am looking for a way to "find" animated GIFs so I can remove them from a folder.
This must work on Windows 7 or Windows XP.
Edit: I am looking to distinguish between animated and regular GIFs. If I could select all GIFs that might be ok as then I could sort by size, but some GIFs are saved with the extension .jpg! That is why I think I probably need a special Image viewer program.
You can use ImageMagick to get the number of frames in a GIF like this:
identify -format "%[scene]\n" YourImage.gif[-1]
identify -format "%[scene]\n" YourImage.jpeg[-1]
It actually gets the frame number of the last frame, so if the image has 37 frames, it will tell you that frame 36 (starting at zero) is the last. So, an animated GIF will give an output of 1 or more since it has multiple frames.
This also works, if the image is mis-named by using a different name suffix. ImageMagick isn't fooled by this, it will still discover that in reality it is a GIF. If it is a standard JPEG, or a GIF with only 1 frame it will return 0.
ImageMagick is free and available for OSX, Linux and Windows - here.

Lossless crop AVCHD and save back as AVCHD

I have many videos are record in AVCHD format by my SONY NEX6 camera. i want to crop those useless shots and save it back to AVCHD. It is because i don't want to convert to other video format which take up more space (Apple ProRes) than the original file, and i don't want to lower the video quality.
Is there any tools out there free or paid is fine. i just don't to to view too much rubbish shots when i play back to video ?
found TMPGEnc MPEG Smart Renderer 4 can crop my AVCHD video clips and save it back to AVCHD file to save space and without rendering
http://tmpgenc.pegasys-inc.com/en/product/tmsr4.html

matlab - VideoReader frames aren't decoded accurately

I am working with video in Matlab, and having trouble.
I'm using Matlab R2012a on a Mac OS X 10.8.2 (Mountain Lion).
I can load a video in using VideoReader and grab a frame like so:
vid = VideoReader('movie.mp4');
pic = read(vid, 20);
imshow(pic);
However, what I see in Matlab is..
Instead of this (in VLC)..
Not only is movement being garbled (the turquoise truck) but the green truck in the background is actually gone by that frame. I'm guessing the codec is compressing the movie in such a way that Matlab isn't compensating for. However, I can't find any other video format that Matlab will accept.
The video shown is mpeg4, yuv420p. I see Matlab mentions a lot about mpeg2 being supported and AVI being the preference. I've converted the video to all sorts of formats using ffmpeg but Matlab has given the following error for every other file format:
Error using VideoReader/init (line 447)
Failed to initialize internal resources.
Error in VideoReader (line 132)
obj.init(fileName);
Any thoughts?
Got it.
Thanks to #wakjah for the tip about QuickTime. A video editor friend suggested MPEG StreamClip to convert to the QuickTime format.
This tool took my mp4 file and let me Export as QuickTime.
Sure enough, Matlab loaded it up the mov file no problem and the artifacts are gone.
Cheers.

Resources