In my application the user can seek to a specific position (media.currentPosition), then press the save button, the image will then be exported, here is my ffmpeg command I'm using to achieve this:
"-i",Video.mp4,"-filter_complex","[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v]","-map","[v]","-ss",GetPositionInVideo,"-vframes","1","-q:v","2", "-preset", "ultrafast",directoryToStore+"/"+"Image.jpg"};
It is a android application so that is way it is in a string array. The command works perfectly BUT it takes forever to complete.
In my log it will show this repeatedly:
[Progress]: frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
until the frame is reached, then it shows this:
[Progress]: frame= 1 fps=0.0 q=2.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.00151x
it then instantly finishes.
So what I think is happening is, ffmpeg processes each frame until it reaches the desired frame and then processes it.
My question:
Is there a way to increase the speed/processing time of exporting a single frame from a video to a image? - Perhaps by skipping the unwanted frames and going directly to the frame the user wants to export?
Answer
"-ss",GetPositionInVideo,
goes immediately before "-i",Video.mp4
for fast seeking.
No comments:
Post a Comment