Set cover image while record audio in android - android

Hello I am recording audio using MediaRecorder and save it in MP4 format. and upload to the server. as well record video as MP4 using camera and upload to server.
So while I am receive my uploaded item from server as uploaded url list. and I am playing all it in VideoView. video and audio play good. now here is the thing while I am playing video it's display video frame on video view but while playing audio it's black. basically audio and video file extension are MP4 so I can't make different while adding it in to VideoView other wise I'll add imageview and display some default image and hide VideoView.
so is there any way to record audio with cover image so while I am playing it in Video view so it display that cover image...
I know that using ffmpeg we can do this but I got lots of error while compiling it in my windows pc. so is there any way to add cover image while record audio with pure android api? sorry for bad english.

I google everything but I can't find any solution for convert audio file to video file with using image. So I have to go with FFMPEG.
So I add WritingMinds java FFMPEG in my project using gradle dependency. Then convert MP4 audio with cover image into the MP4 video.
There are some limitation in this precompile library. like it not work in android 24 and some commands like -speed, cpu-used, -deadline which are most important for all the operation(But still we can perform other operation). there are some disadvantage also like slow speed, and some features which required for specific operation are not include in the compile library. (So I gave advice to compile your own ffmpeg library for android project in linux or mac pc(windowns have lots of issues)).
I hope this will help someone who's this type of scenario :)

Related

How to make a Video Player using Native Android that have resolution switching ability like we see in YouTube?

I want to use a video player eg. using ExoPlayer in android app which will support switching of resolution like we see in YouTube.
My API have video files for 480p,720p,1080p.
I want to give those options in the player and can switch it from the player itself and will play the respective files from URL.
I have seen solutions like track selector etc,but does that work for online files? I have links like :
www.example.com/videos/480/demo.mp4
www.example.com/videos/720/demo.mp4
www.example.com/videos/1080/demo.mp4
Please suggest if there is any other solutions like API change or any other protocols etc.
Why you don't convert your mp4 file to hls or mpd streaming format with ffmpeg so you can stream it chunk by chunk and the player will select the best resolution based on his algorithm?
Have a look at this project, this allows user to select resolution manually via track selection from hls stream encoded by ffmpeg.
https://github.com/namespace7/HLS_Player
To generate hls stream from a video,go through this link
https://superuser.com/a/1302736/1108219

Record Screen video along with the audio

I want to implement screencast feature in my Android app, i.e. Recording the audio and the screen video at the same time and converting it to a .mp4 file.
I got to know that there are some Media Codecs inbuilt in the Android SDK, but the issue with those ones is that I will need to record video and the audio separately and then stitch both of the elements together to create a complete video.
I want to know if a library exists which can directly record both the Audio and Video without the need to stitch them later on.
Thanks in advance!
this project can help you get started here

how to create video using mediaCodec?

Is it possible to create video of series of Images present on SdCard using MediaCodec? if yes, can anyone share me the link?
I want to import images from sdCard and create video from those images, any suggestions???
I want to do this programmatically. I've tried using jcodec library but the process is very slow and I want to fasten up a little bit more.
Is there any chances that MediaCodec can do that in my ADT and in much faster way.
Importing images from SdCard --> making a good quality .mp4 video (faster than jcodec way).
You can try INDE Media Pack - https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials
It has transcoding\remuxing functionality as MediaComposer class and several sample effects like JpegSubstituteEffect - it shows how substitute video frame by a picture from jpg file. You can take black video as a refefence and put images on it with a possibility to set duration, add audio track with help of audio effect etc.

Android VideoView streaming

I have a project with a VideoView in it I am streaming a video from online using this method:
mVideoView.setVideoURI(Uri.parse("http://db.tt/ij7w1Nw"));
My videos are mp4 files downloaded from Youtube. I then upload them to my dropbox, that is where the url comes from. This works fine if I download the video and do not make any changes to it, and upload it straight to dropbox. However if I try to make any changes to it for instance convert from .flv to .mp4, or change the size, then I upload it to dropbox it no longer plays in the VideoView. I get a dialog that says 'Unable to play video. Invalid streaming data'. If I take this same exact video and put it on the SD card either manually or even by having my app download it from the url then play it off of the SD card using
mVideoView.setVideoPath(path);
it works fine. I am using Wondershare Video Converter Platinum to do the conversions and size changes.
Is there some sort of specific encoding that is required to stream an mp4 file rather than play it from a local copy? Am I getting this because of some sort of bug/error with wondershare? Has anyone else experienced this type of problem, if so how did you end up fixing it.
Thank you.
The media format guide may help you see what's available. In my experience wrapping a H.264 AVC or MPEG 4-encoded video in a 3GPP container provides the easiest integration. Android is very fickle with both audio and video streaming.

How to convert 3GP video for Android to view?

I'm creating 3GP videos with the Android - however, when the 3GP files are posted on a site, the same Android phone cannot view it back. (The file works on the iPhone).
What is right way to encode/resize the 3GP video so that the video player on Android can play it back?
Thanks
Solved this by converting it to MP4 and then recompiling the Nginx server to have the MP4 streaming module. By default, Nginx mimetype was set to [application/octet-stream] instead of [video/mp4].
This seemingly was resolved on Froyo handsets - at least, when a 3gp file is opened in a browser window using http, and not rtsp, the video plays fine. On 2.1 it doesn't.
To make mp4 video streamable, you should change it's 'atom' byte order.
I'm using qt-faststart tool from ffmpeg package for this.
This tool changes the order of some meta-data inside mp4 container and as result allows to perform video "streaming" over HTTP.

Categories

Resources