How can we achieve audio passthourgh in Chromecast Styled Media Receiver - android

We're trying to play 5.1 audio on Chrome-cast Player via Audio Passthrough from Android app. But we get only 2.1 as audio output.
Even when we ingested only 5.1 audio, we have received below error,
[cast.player.hls.PackedAudioParser] Neither ID3 nor ADTS header was found at 0
[cast.player.api.Host] error: cast.player.api.ErrorCode.NETWORK/315
Reference:
https://developers.google.com/cast/docs/media#audio_passthrough
Encoding tool used: ffmpeg
Input Params:
Url: http://cdn.example.com/video.m3u8
MimeType: application/x-mpegURL
Audio codec: ac-3
Sample m3u8 file
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio/6ch",LANGUAGE="tam",NAME="Tamil",CHANNELS="6",URI="https://cdn.example.com/videos/audio_video_seperation/audio_5.1/master.m3u8""
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio/mp4a/2ch",LANGUAGE="tam",NAME="Tamil",CHANNELS="2",URI="https://cdn.example.com/videos/video_audio_seperation/audio_2.1/master.m3u8"
#EXT-X-STREAM-INF:AUDIO="audio/6ch",BANDWIDTH=1045504,AUTOSELECT=YES,CODECS="avc1.4D401F,ac-3",RESOLUTION=853x480,FRAME-RATE=25.000
https://cdn.example.com/videos/video_audio_seperation/video_480/master.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,AUDIO="audio/mp4a/2ch",SUBTITLES="subs",BANDWIDTH=1044480,CODECS="avc1.4D401F,mp4a.40.2",RESOLUTION=853x480,FRAME-RATE=25.000
https://cdn.example.com/videos/video_audio_seperation/video_480/master.m3u8
Chromecast debug messages:
Device supports ac-3 encoding
Queries:
Is there any sample media file available to test 5.1 audio on chrome-cast?
Which is right way to decouple audio and video stream from source mp4 file for HLS?
Any sample ffmpeg command is useful
How to fix or check ADTS header issue on audio file?

Related

Is Android.net.rtp only for VoIP ppplication?

From API 12, Android have its only RTP package, which is android.net.rtp.
There are 4 classes in this package: RtpStream, AudioStream, AudioCodec and AudioGroup.
However, it seems that all those classes are only for VoIP application. I'm trying to stream some 'static' audio file (such as MP3 file on SDCARD) by using RTP protocol to VLC player and I find it somehow impossible by using android.net.rtp.
I tried this example: http://androidsourcecode.blogspot.com/2013/10/android-rtp-sample-receiving-via-vlc.html
The result is: The sound from the mic of my android phone was sent successfully to my MAC VLC player very well.
So, is it possible to stream 'static' file through android's native media decoder, and push decoded data to AudioRecord then again to AudioStream?
To make it simple, is it possible to make a fake microphone (MP3 file -> MediaPlayer -> AudioRecord -> AudioStream) pipeline?

Android Streaming video MOV with ACC (mp4a) audio and H264 video

I would like to show some video in my android application.
Video are like: http://myserver.com/video/myvideo.mov All the video are in .mov and some in .flv.
.mov have H264 - MPEG-4 AVC (avc1) video channel, and MPEG ACC Audio (mp4a) audio channel.
.flv have Flash Video (flv1) video channel, and MPEG Audio layer 1/2/3 (mpga) audio channel.
If I play the .mov with the default android player I can see the video image, but I can't hear anithing.
With the .flv I can see and hear the file in the default android player.
Is there a way to play correctly the .mov with the MPEG ACC Audio (mp4a) audio channel?
Anyone know if there is a custom library to play this .mov files? Thank you in advance!
As stated here MOV container even with H264/AAC inside is not supported in Android. The underlying reason is that MOV (aka quicktime file format) is a proprietary container from Apple (it is a close one from MP4 but still not the same) - most of the time it works 100% only on Apple device and/or quicktime player.
FLV container from Adobe is also not supported in Android (FLV can be packed with H263 or H264 video inside).
It can work on some device but as you experienced it, it can be clunky and surely inconsistent across devices.
Your best bet is to package/transcode your file in a format where you know you will have cross-Android compatibility.
If you want it badly you could think about building your own video player/decoder to play back mov/flv files (like with ffmpeg) but it is an advanced project in itself and providing code for that would be outside of the scope of stackoverflow - maybe have a look here.

Impossible to mix audio file and video file using MediaMuxer?

I'm developing an Android App that records screen video and audio.
I recorded these 2 files : mp3 audio file and mp4 video file(no sound).
Now I want to mix them and create a new mp4 video file(with sound).
From Android 4.3, Google suggests using the MediaMuxer class to mix stream audio and video. I have tried many times without success.
Any solution to resolve my issue with MediaMuxer API from Google?
Any help will be greatly appreciated.
MediaMuxer does not transcode.
If you write out an MPEG4 file, it will expect the video file to be MPEG4/AAC and the audio file to be an AAC file (m4a) as well.
Once you feed it with an m4a, muxing will succeed.
This is a full sample source code to merge wav audio file to mp4 video file :
https://github.com/tqnst/MP4ParserMergeAudioVideo

Windows Media Player cannot play MPEG-TS file created in Android.

I tested the StageFright record sample (frameworks/base/cmds/stagefright/record) to create a mpeg2 TS file. While it can be played on Android default Media player, it cannot be played in Windows Media Player or MPlayer. Any suggestions?
Note that I modified the original record sample source to create MPEG-TS file instead of MP4 file.
Which codec you used to create the mpeg2 TS file. May be difference in the codec used is the problem.

Android mediaplayer radio streaming with wma codec

I'm trying to play radio audio stream from the media player in android 4.0.3 API15.
Some of the stations work, but a lot of the stations fail, for example :
http://switch3.castup.net/cunet/gm.asp?ai=31&ar=88FM
This station(and many other) is returning me the following error:
error (1,-21477483648).
I checked the codec being used in that station and its wma.
The media player doesnt support this codec but i know that there is application("Radio Israel") that can play this station.
My question is , is there any workaround for playing that stream?
Thanks
WMA is a Windows format and Android is Linux. You could use a proxy server of your own to encode into MP3 (or another format) then stream from there.

Categories

Resources