In my application, we are capturing a video and uploading it to YouTube. But the requirement is, we need to display one image for 2 seconds before the video and after the video (similar to ads in Youtube videos)
And also we need to display a logo at bottom right corner of the video.
I searched for YouTube API for this and couldn't find any clue. Is there any way to do this?
Thanks in advance.
As far as the logo goes, your best bet would probably be to extend the YouTubePlayerView and add the logo on top of the video.
For displaying the image, I would create a layout that can hold either the video or the image. You could then use a FragmentManager to switch between the image and the video. Use a Timer to display the image for 2 seconds and then use the FragmentManager to switch to the YouTubePlayerView (or whatever your extended class is).
Then you will have to extend the YouTubePlayer.PlaybackEventListener to work with your new view. Call the onStopped() method of this listener to switch back to the image after the video is done playing.
EDIT
What it appears you want to do is some video editing. This is definitely not something that you will be able to do through the YouTube API, so you have no choice but to do it natively though the app.
First, you will have to convert the image to an mp4 file. This is no easy task, but this code seems to provide a solution. Make sure that the video from the image has the same encoding as the original video. This makes it possible to combine the videos using MP4Parser (although I have never actually used this library, it claims to work for this).
Finally, to make the video upload to YouTube with the logo, you will need to decode the video, embed the image onto every frame, and encode again. Doing this manually would be difficult, so I recommend using something like ffmpeg. FFmpeg contains a bunch of useful libraries and functions for multimedia data handling like this. Here is a link to an Android wrapper for FFmpeg. I have used ffmpeg alot in the past and the man page is pretty helpful, but I have not tried it on Android.
Related
The goal is to analyse a video frame by frame and apply a painting on each of those frames. Then save the video and be able to play it.
Do you know if such a thing is possible in flutter? I've heard about ffmpeg package but I'm not too sure if that's possible with it.
I would recommend to make this implementation on respective platforms. It will be more performant that way and you can get complete control of the video generation.
on iOS : AVMutableComposition class is the way to go
I don't know about android.
I am trying to display the preview thumbnail when user move his finger over video scrubber.
The only solution I m finding is to extract thumbnails using some 3rd party tool and save it to server or pass it to app via some JSON.
What I m trying to do is something similar to JwPlayer (http://jwplayer.electroteque.org/controls-preview)
Any idea where to start?
Or is here any standard protocol that support manual generated thumbnails? Or i need to go with my own feed format.
I don't quite know what the configuration of your project is, but one possibility is too actually instantiate a mini player and display the progress of the video as the user the slides. So essentially this "mini player" would appear when the user begins drag, and skip to whatever time is specified, and pause. It is similar to a project I am working on now. This is a great reference as well: http://www.autodeskresearch.com/pdf/p1159-matejka.pdf. This technique is much different then the one I suggested, but is another alternative depending on your scenario.
I've been working on this videos thing in android and I thought to make it more functional. I have a question that, is there any way we can insert or remove frames from some video, like edit videos the same way we edit images, give them effects and all. I think, I am clear. Any links, sample codes, hints or books would be useful to start with this.
thanks :)
Here are multiple things you can look for video editing.
The more efficient in FFMpeg android sample for processing video (so that effects on video applied and saved on device as new video with applied effects) FFmpeg android java
For run time effects, just to show the user effect on video while running in your app, can use Vitamio
In my app I have a requirement to create a video from the screen activities programatically. (ie: I am running some animations for some time I need to convert these animations to a video, like video demos.)
I have been searching for this for the last week, but I haven't found any solution. I don't know whether it is possible in Android or not. If it is, please tell me the way or suggest me some links.
If you want to capture the screenshots from "within your activity", it is possible. Follow this post
Having grabbed the screenshoton a bitmap, you need to encode the frames to a video yourself.
Captured bitmap --> JNI (Native-bitmap) --> feed input buffer to a native encoder (ffmpeg) --> save to file
This project will meet your request Android-MJPEG-Video-Capture-FFMPEG
It is just to convert jpegs into a movie file by ffmpeg bin
I want to store the thumbnail image for video after the user start recording, because i want to use the only few video to list which is stored under specific instead of all video from sdcard.
If i want to shoe all video i got the thumbnails form MediaStore class, but i need for specific video i have to store the thumbnails separately for the particular video. Any suggest
some idea to achieve this.
If it is possible tell me how to capture the surface View of camera to save it as bitmap image for use it as Thumbnails.
Thanks
The first frame can be taken using the NDK and ffmpeg, but it's more trouble than it's worth.
The simple way is to use ThumbnailUtils as per this answer, provided you are on android-8 (Froyo) or later.