Record video with overlay pager android - android

I am working on one of my app in android which have functionality to capture video with overlay view pager. I tried take snapshot of view of every moment and after that use frames to make video using opencv and ffmpeg plugin but still there is no success . I need solution that how can i achieve this thing .
Sorry for unclearness , i am new here.
Please guide me solution anyone .
Here is what i want to achive

Did you try ffmpeg -r 1/5 -start_number 2 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4?
I guess that's what you want.
I actually do this things with Blender 3D software but It's a little bit technical.

Related

ffmpeg: Video duration confused for some players on Android

I am using ffmpeg to scale down and compress videos to be used in Android app.
The original files are played with no problem and have no metadata issues. When I re-encode them however, the Android player is able to play them, but displays wrong durations. My app is in production and it is using official player implementations, so I wonder if there is a way to fix the corruption using ffmpeg or adding some metadata to the generated files. Hopefully that's possible, but if not - any other possible fixes will be highly appreciated :)
My ffmpeg command is complex, including scaling and encoding but I can confirm this issue is reproducible on my end with the simplest ffmpeg -i video.mp4 -c:v libx264 videogen.mp4 command.
I'm leaving links to the two files if that's helpful for reference.
video.mp4
videogen.mp4
Any ideas what could be causing this and how to fix it?
Player issues showcase:
video.mp4 (original)
videogen.mp4 (re-encoded)
After some testing I found out that the player was playing fine files with the following metadata:
major_brand=mp42
encoder=Lavf58.24.101
So I used ffmpeg -movflags use_metadata_tags to set the working metadata :)

Add graphical annotations to a video e.g random drawings using flutter

I have developed a flutter app in which i am using FFmpeg library for video manipulation ,
Actually i want to draw some random drawings in to a video and make it a part of the video.
what i am already doing is that , i added some annotated images into a video by using ffmpeg library in flutter , but the problem with ffmpeg is that it is very time consuming ,it is taking almost 10sec for a 10sec video clip.
ffmpeg command i am using is:
ffmpeg.execute("-y -i input.mp4" " -i input.png -filter_complex \"[0:v][1:v] overlay=(W-w)/2:(H-h)/2'\" -pix_fmt yuv420p -c:a copy output.mp4")
I want to do it as fast as whatsapp annotations...
any idea how to do that ?

How to convert a single Image to MP4 Video?

How to convert a single image to mp4 video.
For example, I need to play the same image for 20 seconds (duration will be dynamic)
I know it's possible with ffmpeg. I searched in google & SO but unfortunately, I am not able to find the correct tutorial.
I just want a correct direction.
Any comment or suggestion is welcome.
Basic syntax is
ffmpeg -loop 1 -i image -pix_fmt yuv420p -t 20 out.mp4
The -t option sets the time, in seconds.
You can always use any video edit like windows movie maker.
Just add the photo to a project change the duration to 20 seconds and export
And then you have a 20 second video file of one image

Convert video to slow motion and fast forward like snapchat

I am trying to convert video file in slow motion or fast forward motion, just like snapchat. Tried mediacodec but didn't worked.
Can anyone tell me if there is any 3rd party library or something to accomplish my task.
Any help is highly appreciated.
You can use ffmpeg library for this
To double the speed of the video, you can use
ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv
To slow down your video, you can use this comand
ffmpeg -i input.mkv -filter:v "setpts=2.0*PTS" output.mkv
For more details look into this link https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video

FFmpeg mp4 encoder for html-android

Hello I'm trying to put video .mp4 auto-captured by my webcam using ffmpeg into HTML (running ffmpeg in desktop-linux), and then activated my localhost so my android will able to see it.
the video.mp4 was able to run in linux, and in html-desktop.
the video in my android-browser(html-android) WAS ABLE to play too BUT it's all white and pixels error, so it's a fail.
I thought because android has difference surface because in my desktop it runs perfectly, then i keep searching and trying with ogv/webm.
In the end, I just use a downloaded another mp4 and it runs perfectly tho.
now I think the problem was coming from my mp4-webcam created by ffmpeg(run in cmd)
I compare a mp4-webcam vs mp4-downloaded
5sec vs 1min,
Data-rate: 16477kbps vs 613kbps
framerate: 30frm/s vs 23frm/s
size: 9MB vs 5 MB
even tho it's only 5sec video by webcam, it still has larger data than a 1min video-downloaded maybe it was because without conversion.
but the question, is that the reason of the problem ? android-html(google chrome) wasn't able to display and make a dead pixels since in desktop it runs. it shouldn't be the problem right ?
I really need to transfer webcam-record into android-surface (my web-app).
I have no idea to fix it, any advice ? I've been searching a lot. Maybe there was another problem I do not know yet.
EDIT: my cmd ffmpeg run : ffmpeg -y -f v4l2 -i /dev/video1 -codec:v libx264 -qp 0 -t 0:00:05 hss.mp4
EDIT 2: my 2nd thought because ffmpeg encoder that I used(libx264) isnot support for android. but i still no idea
I just converted mp4-ffmpeg to webm , webm is more friendly for video-browser

Categories

Resources