Objective: i) I want to play video that i captured on my android phone to IOS and vice versa.
Problem: Android captures it in mp4 while IOS plays in Mov.
Solution: I can do conversion of formats before uploading to server but thats a slow process
and causing performance issues.
Is there any library or solution that does it without slow it down?
I believe whatsapp does it by only uploading stream and making it correct format when someone requests to play it. Im not sure though how they do it.
Why not play the mp4 video on iOS? What need is there to convert?
EDIT: Also forgot to mention, mp4 and mov are basically the same format. You can literally just rename the extension (on iOS at least) and the video still plays.
Related
Let me refraise my question, I wrote it in a hurry.
Current situation:
I have set up a digital video recorder to record broadcasts provided via DVB-C. It is running on a raspberry 3B using TVHeadend and jetty/cling to provide UPnP and other possibilities to access media files. For watching recordings, I wrote an android player app using IJKPlayer, which runs on smartphones, FireTV and AndroidTV.
One hassle when playing media files which are currently beeing recorded is, that IJKPlayer doesn not support timeshifting. Means, when I start playing a currently recording file, I can only watch the length which is known by the player at that moment. Anything which is recorded afterwards can not be played. I need to exit the player activity and start it again. I have resolved that issue by "simulating" a completed recoding using a custom servlet implementation. Since the complete length of the recording is already known, I can use ffmpeg to accomplish this.
Future situation:
I plan to move away from IJKPlayer to ExoPlayer, because it supports hardware playback and is much faster when playing h.264 media. I can of course use the same solution like above, but as far as I have found out yet, ExoPlayer can support media files which are currently being recorded by using the Timeline class. However, I don't seem to find neither a usefull documentation nor any good example. Hence, I would appreciate any help with the timeline object.
Regards
Harry
Looks like my approach won't work. At least, I didn't find a solution. Problem is, that the server returns the stream size as it is during player-start-time. I didn't find a method to update the media duration for "regular" files.
However, I can solve the problem by changing the server side. Instead of accessing a regular file, I convert the file to m3u8 in realtime, using ffmpeg. I then throw the m3u8 URI onto the player and it updates the duration of the stream (while playing) without the need to create any additional code on the client side.
After an intense search on this site I found nothing which fits
my problem. I want to write a small video streaming client on
an Android 5.1 device. The following code is used:
QApplication a(argc, argv);
QWidget *widget=new QWidget;
widget->resize(320,200);
QMediaPlayer *player=new QMediaPlayer;
QVideoWidget *vw= new QVideoWidget;
QHBoxLayout *layout=new QHBoxLayout;
layout->addWidget(vw);
widget->setLayout(layout);
player->setVideoOutput(vw);
player->setMedia(QUrl("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"));
player->play();
widget->show();
The problem is, the sound works but I only get a white screen.
the sound is playing but no video.
The VLC player on the android device is playing the video
correctly. I also used a small player in android studio and
it plays the video (but with high latency, so it is not useful for me)
I ran out of options what I can change to make it run.
Qt is not media friendly, if you want to play specific format/codec like MOV or h.264/h.265 ect... in a crossplatform way I advise you to use external lib like QtAV (http://www.qtav.org/) or VLC Qt wrapper (https://github.com/RSATom/QmlVlcDemo)
I believe the problem is that Android devices do not support the QuickTime Format (MOV) by default.
VLC Media Player on the other side, is well-known to be able to correctly play MOV videos.
Try testing videos with another format such as MP4or WebM to see how the program behaves.
I once developed a desktop software for streaming audio/video in Qt and I had the pleasure to work with the GStreamer framework.
Among many functionalities, it allows you to convert MOV videos to other formats.
You may check the GStreamer for Android tutorials and QtGstreamer, a set of well-implemented GSstreamer bindings for Qt.
I am building an app which allows users to upload videos from different devices including android and iOS then stream them from server with VideoView during playback. I end up with different video formats and get the inevitable "Cannot play this video" error on several occasions.
Some research says that videos with format .mp4 and codec H.264 can work on all devices, so I have a few things I am working on.
Convert all videos on server side to the above mentioned format and codec
Use ffmpeg to convert the videos in app during playback
Use VLC sdk which supports a wide range of video formats
I am not sure which if these is the best solution, I have not worked with videos a lot in the past on Android and I am not sure what the pros and cons maybe or if indeed these are viable solutions or if this problem already has a known solution.
I am (at long last) at the very end of a VOD project. It works perfectly, except on Android. Basically, on Android video will not play until the entire video has downloaded. A media server was well out of scope, so we are just serving the videos up from AWS S3. Works fantastically on iOS. Both streaming and downloading the video works exactly as you would expect it to. On Android, it just doesn't seem to want to play before the download finishes. It works well when using a server on the local network (I even see the occasional buffer, so I know it's not just quickly downloading), but nothing remote.
My only guess is that it is to do with the differences in the way iOS and Android stream video. On iOS, video streams via byte-range requests. Every few seconds, it will time itself out and request another range of bytes for the file. On Android, it only sends a single request for the entire file. Not sure how that could be fixed, however.
Does anyone have any tips or pointers here? Any help would be greatly appreciated here.
Happens on Android 4.4 and 4.3.
Using both a remote prod server we own and AWS S3.
AIR 3.9 with Flex 4.11
Utilizing StageVideo and NetStream
Test devices are a Nexus 5 and a Nexus 4
The issue was with the videos themselves. AIR for Android uses the standard approach to streaming where the entire file is requested and it reads it bit-by-bit (as opposed to iOS which requests specific byte-ranges repeatedly).
The problem here is that the player cannot begin playback until the video's metadata has been read. A standard h.264 encode sees the metadata (moov atom) located at the very end of the file, so the video does not begin until the entire video has been downloaded.
Easiest way I have found to fix this is re-encoding the videos through Handbrake with the "Web Optimized" option selected. This will ensure the metadata is located at the very beginning (byte 24, I believe) so the video should begin playing instantly.
Explanation from Adobe
Thread that gave me the idea to use the "Web Optimized" option
I am new to android and trying to streaming video from my server.
When i run the application it gives Error "sorry,this video is not valid for streaming to this Device.." than i download and push to sdcard of my device(samsung Galaxy 5)this time video is playing.... i convert this video by SOTHINK VIDEO CONVERTER..
Any Help??
Thanks..
We ran into exactly the same problem, and I found a solution at this link:
http://code.google.com/p/android/issues/detail?id=9044
In short, if you have access to a Mac, you can encode the videos using HandBrake. Be sure to check the "Web optimized" checkbox. I'm encoding as format:MP4 file, Video Codec: H.264. After I did this and uploaded I was able to view the videos (or at least listen to them) in a 2.1 simulator, which had been giving that exact warning message before. I have not been able to get a hold of an actual 2.1 device, but I suspect it will work. When I confirm that I'll check back in here to let you know.
It seems that you are talking about sothink video encoder engine. Actually this program only supports the apple devices in ios system, for example, iphone, ipad and ipod.
Here is the official product homepage of sothink video encoder engine, and hope it helps!
http://www.sothinkmedia.com/flash-video-encoder-command-line/
The only issue for error "sorry,this video is not valid for streaming to this Device.." is that there is some problem in video format. Just correct the format/codec of mp4 and then it would run gracfully.