last day (14 days later) » 

5:27 AM
0
A: how to create video from images using ffmpeg Android?

MulvyaUse cmd = new String[7]; cmd[0] = "-f"; cmd[1] = "image2"; cmd[2] = " -framerate"; cmd[3] = " 25"; cmd[4] = "-i"; cmd[5] = Environment.getExternalStorageDirectory()+"/Photo Story/image%d.jpg"; cmd[6] = PathVideo + "/"+ FileName; Replace 25 with the variable or value of framerate.

 
min FPS for video?? i used 4 FPS and got error Unable to find a suitable output format for '4'
 
Show the formatted command. That message indicates that ffmpeg is interpreting 4 as an output filename.
 
can you share code for genearte video from images with FPS = 4??
 
ffmpeg -f image2 -framerate 4 -i "path/to/image%d.jpg" "/path/to/output.mp4" <-- this is the command your code should generate.
 
cmd = new String[11]; cmd[0] = "-f"; cmd[1] = "image2"; cmd[2] = "-framerate"; cmd[3] = "1.0"; cmd[4] = "-i"; cmd[5] = Environment.getExternalStorageDirectory()+"/Photo Story/image%d.jpg"; cmd[6] = "-vf"; cmd[7] = "fps=1"; cmd[8] = "-pix_fmt"; cmd[9] = "yuv420p"; cmd[10] = PathVideo + "/"+ FileName;
 
5:27 AM
You don't need the filter. If you're having an issue with the display of the last image, just duplicate that file and rename it to end the sequence.
 
video generated sucessfully but how can i add audio when generating video . i used below code cmd = new String[11]; cmd[0] = "-f"; cmd[1] = "image2"; cmd[2] = "-framerate"; cmd[3] = "3"; cmd[4] = "-i"; cmd[5] = Environment.getExternalStorageDirectory()+"/Photo Story/image%d.jpg"; cmd[6] = "-vf"; cmd[7] = "fps=1"; cmd[8] = "-pix_fmt"; cmd[9] = "yuv420p"; cmd[10] = PathVideo + "/"+ FileName;
 
Insert a -i audio.mp3 and -c:a copy If the audio is longer than the video, also add -shortest
 
its not working. just display video without audio
 
Show the full console output of the command.
 
Error parsing options for input file /storage/emulated/0/Music/Lalla+Lalla+Lori_5974763.mp3.
cmd = new String[16]; cmd[0] = "-f"; cmd[1] = "image2"; cmd[2] = "-framerate"; cmd[3] = "3"; cmd[4] = "-i"; cmd[5] = Environment.getExternalStorageDirectory()+"/Photo Story/image%d.jpg"; cmd[6] = "-vf"; cmd[7] = "fps=1"; cmd[8] = "-pix_fmt"; cmd[9] = "yuv420p"; cmd[10] = "-i"; cmd[11] = AUDIOPATH; cmd[12] = "-c:a"; cmd[13] = "copy"; cmd[14] = "-shortest"; cmd[15] = PathVideo + "/"+ FileName;
Option vf (set video filters) cannot be applied to input file /storage/emulated/0/Music/Lalla+Lalla+Lori_5974763.mp3 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Thanx - Mulvya i got sollution cmd = new String[16]; cmd[0] = "-f"; cmd[1] = "image2"; cmd[2] = "-framerate"; cmd[3] = "3"; cmd[4] = "-i"; cmd[5] = Environment.getExternalStorageDirectory()+"/Photo Story/image%d.jpg"; cmd[6] = "-i"; cmd[7] = AUDIOPATH; cmd[8] = "-c:a"; cmd[9] = "copy"; cmd[10] = "-vf"; cmd[11] = "fps=1"; cmd[12] = "-pix_fmt"; cmd[13] = "yuv420p"; cmd[14] = "-shortest"; cmd[15] = PathVideo + "/"+ FileName;
@ Mulvya - how to generate video in reverse oreder?
 
5:27 AM
If your ffmpeg version is recent, you can use reverse filter i.e. -vf fps=1,reverse. But this will read entire sequence into memory.
 
reverse: Invalid argument
 
You've an old version of ffmpeg. You'll have to rename your images in reverse order.
 
i have 100 images in folder but i wants to use only first 50 images to generate video. what is command for that??
 
You'll have to insert -t n before -i where value of n is no. of required images / framerate
 
please send me link for latest ffmpeg lib
 

last day (14 days later) »