Xamarin Media Plugin

Hey!

We are using the Xamarin Media Plugin (https://github.com/jamesmontemagno/MediaPlugin) on iOS to capture video and it works really well. On Android we are able to capture video as well but the audio codec it is using is AMR Narrowband which will not play on iOS. Does anyone know on android

1.) How to make Media Plugin us the AAC codec
2.) Convert the AMR to AAC so that a video captured on Android will play on iOS

I have tried:
MediaMuxer (but can't find a complete enough example to copy and use)
Xamarin.MP4Transcoder (but can't find a way to set the audio codec)

Thanks ahead of time!

Best Answer

  • TylerFoucheTylerFouche US ✭✭
    Accepted Answer

    Ok, so I couldn't figure it out. I just used good old FFMPEG on our amazon ec2 box to re encode the audio to AAC and it works like a champ now.

    $cmd = $ffmpeg_bin."-y -i ".$file_i." -ab 26k -f mp4 ".$file_o;
    error_log( shell_exec( $cmd." 2>&1" ) );

Answers

  • TylerFoucheTylerFouche USMember ✭✭

    After looking at the code for the MediaPlugin it looks like the capture is coming from a new intent. So my question my be better phrased as "How do you control a video capture intent's audio codec".

  • HashimKSHashimKS USMember ✭✭

    Hello , Any updates on this? I am also facing this issue. :(

  • TylerFoucheTylerFouche USMember ✭✭

    Not quite. I am messing with the transloadit api to see if I can encode the videos that way! https://transloadit.com/ . Its not ideal because if I can do it on the device then I save all the server time, but it would be nice to have m3u8 streams too . . . .

  • TylerFoucheTylerFouche USMember ✭✭
    Accepted Answer

    Ok, so I couldn't figure it out. I just used good old FFMPEG on our amazon ec2 box to re encode the audio to AAC and it works like a champ now.

    $cmd = $ffmpeg_bin."-y -i ".$file_i." -ab 26k -f mp4 ".$file_o;
    error_log( shell_exec( $cmd." 2>&1" ) );

Sign In or Register to comment.