Playing video from FFMpeg command in Android MediaPlayer - android

In iOS, We can make a video composition with video track, audio track and some complex stuffs with AVComposition and we are able to play that with AVPlayer directly without writing that composition to a video file.
Well, it is possible to make a similar composition of video with FFMpeg command in Android. It is also possible to stream from the command. My question is, can we play the output of a FFMpeg command in Android Media Player like playing a AVComposition in iOS?
Thanks for your help.

Related

Set cover image while record audio in 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 :)

Android media controller doesn't play sound for iOS recorded videos

I am currently developing a video streaming feature for one of my android apps. I am using android media framework for the purpose. Videos are streamed from an nginx server. Android recorded videos works fine but iOS recorded videos plays only the video not the sound.
It happens because the android support limited codecs in-built like mp3,mp4,mpeg.
While iphone support most of codecs.
What is the way to resolve this?
MP4 for video and MP3 for audio are widely accepted and work on both platforms.
So you need do some stuff at the server. Implement the ffmpeg library that will convert all the videos to MP4 and audio to MP3.
We are doing same mechanism to resolve this issue.
Some more information to understand the problem
Refer stackoverflow answer here
Hope This may help you to get the rid of your problem
Happy Coding!

Android encode video with ffmpeg while it is still recording

I want to develop an android aplication which allows me to continuously record a video and upload parts of the video to a server without stopping the recording.
It is crucial for the application that I can record up to 60 min without stopping the video.
Initial approach
Application consits of two parts:
MediaRecorder which records a video continuously from the camera.
Cutter/Copy - Part: While the video is recorded I have to take out certain segments and send them to a server.
This part was implemented using http://ffmpeg4android.netcompss.com/
libffmpeg.so. I used their VideoKit Wrapper which allows me to directly run ffmpeg with any params I need.
My Problem
I tried the ffmpeg command with the params
ffmpeg -ss 00:00:03 -i <in-file> -t 00:00:05 -vcodec copy -acodec copy <out-file>
which worked great for me as long as Android's MediaRecorder finished recording.
When I execute the same command, while the MediaRecorder is recording the file, ffmpeg exits with the error message "Operation not permitted".
I think that the error message doesn't mean that android prevents the access to the file. I think that ffmpeg needs the "moov-atoms" to find the proper position in the video.
For that reason I thought of other approaches (which don't need the moov-atom):
Create a rtsp stream with android and access the rtsp stream later. The problem is that to my knowledge android SDK doesn't support the recording to a rtsp stream.
Maybe it is possible to access the camera directly with ffmpeg (/dev/video0 seems to be a video device?!)
I read about webm as an alternative for streaming, maybe android can record webm streams?!
TLDR: Too long didn't read:
I want to access a video file with ffmpeg (libffmpeg.so) while it is recording. Fffmpeg exits with the error message "Operation not permitted"
Goal:
My goal is to record a video (and audio) and take parts of the video while it is still recording and upload them to the server.
Maybe you can help me solve the probelm or you have other ideas on how to approach my problem.
Thanks a lot in advance.
Your real time requirement may lead you away from ffmpeg to webrtc and or to html5.
some resources;
http://dev.w3.org/2011/webrtc/editor/getusermedia.html (section5)
https://github.com/lukeweber/webrtc-jingle-client
ondello .. they have api
rather than going native and trying to get at the video stream or getting at the framebuffer to acquire an xcopy of what is in the video buffer, and to then duplicate the stream an manage a connection (socket or chunked http), you may want to look at api type alternatives....

Record and playback live stream video in android

How can I record and stream a live video from an rtsp link and playback it later?
I don't think the framework directly allows you to do that. Install ffmpeg to do this if you want to do it.

Additional .mp4 decoders for VideoView

I am building an app that downloads .mp4 files from the Internet and plays them.
It seems there are no decoders for this particular video type, and I only get audio, no picture. The same thing happens with the standalone player, so it is not a problem with the program or file.
Is it possible to use a user library for the decoding and plug it into VideView?
The .mp4 in question can be found here: https://www.coursera.org/modelthinking/lecture/preview_view?lecture_id=17
Thanks in advance.

Categories

Resources