libvlcsharp - iOS transcode not accepting media option parameters - xamarin.ios

I've been using the Xamarin libVLCSharp player for a while on iOS and Android and it works well. I've added a transcoding feature, but for some reason my libVLCSharp code works fine to transcode on Android (change codec, bitrate, fps), but the same transcode media options on iOS (iPhone 12 pro, iOS 14.4.2) produce no changes in the output video file compared to the input video file. I have attached the sample video file which I am attempting to transcode.
Here is my C# code (which contains the transcode media options that works on Android, but not iOS):
Core.Initialize();
_vlc = new LibVLC();
_player = new LibVLCSharp.Shared.MediaPlayer(_vlc);
_media = new Media(_vlc, _source, FromType.FromPath);
_media.AddOption ($":sout=#transcode{{vcodec=h264,vb=700000,acodec=aac,ab=96,channels=2,samplerate=44100,scodec=none}}:std{{access=file,mux=ts,dst={destination}}}");
var result = _player.Play(_media);
Any help or pointers on why this transcoding command is not producing any change in the output media file compared to the original would be greatly appreciated!
iOS Logfile
https://drive.google.com/file/d/1C0UGzE7hqCJYozTvubyK1BKWcZvG18VY/view
Sample file I'm using to test transcoding:
https://drive.google.com/file/d/1MvJKJnu2ii6XMANuWRkHLqmu78e9x03q/view

Try with
$":sout=#transcode{venc={module=avcodec{codec=h264_videotoolbox}, vcodec=h264},venc={module=vpx{quality-mode=2},vcodec=VP80},samplerate=44100,soverlay}:file{dst={destination},mux=ts}"
Feel free to remove unnecessary options, but from my findings this exact string should work.

Related

How to get media bitrate with Libvlc

I'm using libvlc to play video files while downloading them. My problem is that libvlc_media_player_get_length returns nothing.
Also I thought about calculating an approximation using the bitrate and the file size, but I don't find how to get the bitrate with libvlc.
Is there a function for that ?
Thanks
I finaly find this way:
libvlc_media_stats_t stats;
if (libvlc_media_get_stats(vlcmedia, &stats))
{
long p=libvlc_media_player_get_time(vlcmediaplayer);
if (p)
bitrate=stats.i_read_bytes/p;
}
libvlc_media_tracks_get returns one or more structures containing track information.
If the track type is audio or video there is libvlc_audio_track_t.i_bitrate or libvlc_video_track_t.i_bitrate accordingly.
This API was added at version 2.1.0 of LibVLC, see http://git.videolan.org/?p=vlc.git;a=commit;h=cd5345a00009f2fc571c23509a025331ad24fc87.
VLC 2.1.0 was released in September 2013.

Android Libstreaming: How to improve video quality (Testing in Nexus 5)

I am developing an android application. I am sending stream (audio+video) from Mobile to Wowza. I am using Libstreaming library for streaming. The video quality is too bad. How can we improve it (atleast some text should be readable.)
In my code if you see I have commented the video quality (bad with mentioned parameters) method. If i uncomment it, It shows the green cover over the video screen.
And also, is it possible to make quality device independent ?
My streaming code is:
mSession = SessionBuilder
.getInstance()
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setAudioQuality(new AudioQuality(8000, 16000))
.setVideoEncoder(SessionBuilder.VIDEO_H264)
//.setVideoQuality(new VideoQuality(352, 288, 30, 300000))
.setCamera(CameraInfo.CAMERA_FACING_BACK)
.setSurfaceView(mSurfaceView).setPreviewOrientation(0)
.setCallback(this).build();
Thanks.

FFmpeg library: Muxing audio from external file

I have successfully changed the muxing.c sample to use video frames that I generate on runtime.
I am trying now to replace the get_audio_frame function with a function that decodes an existing audio file, and writes its samples instead of the synthesized audio-samples in the example code.
I've tried using the "audio decoding" example to decode the audio file, but the not sure how / when to write the samples decoded.
I suggest to check the source of my Karaoke Lyrics Editor which is doing exactly what you need based on ffmpeg. See ffmpegvideoencoder.cpp, see createFile and encodeImage functions.

how to decode amr files using c#.net

I need to decode amr format to pcm format, which is later converted to mp3 using c#.net. But I am hardly finding any library to do so. It seems with NAudio it is not possible. Is there any c# based open source library which can be used to decode this format files?. Presently I am working on windows server 2012(64 bit).
NAudio Code:
public void Decode()
{
.....
var result= new MediaFoundationReader("..\\sample.amr");
// later converted to mp3 here
}
It looks you two guys are doing the same thing: How to convert amr files to mp3 using C#
You typically need to have a [third party] AMR decoder installed and integrated into Windows API (ACM, DirectShow, Media Foundation). Then you will use your favorite library around this API, such as NAudio.
Example of AMR decoder: MONOGRAM AMR Pack.
You're unlikely to find a C# decoder for AMR files. I'd recommend just finding a command-line utility that you can call to convert to PCM. For example, it looks like sox can be used to decode AMR.

Cloudfront issue streaming certain video files with VP6F and MPEG audio

Greetings fellow amazonians
We have certain f4v files from webtvinteractive.com that are not working from a streaming distribution. The cloudfront diagnostic tool indicates the file is not found but from a download distribution they play all ok fine ??
When inspecting the codec the only difference we see is that the audio is encoded as MPEG audio layer 1/2/3 (mpga) instead of AAC (mp4a)
Also noticed that VP6F is used but that is a Abobe proprietary codec so it should stream all ok from Flash Media Server
Here is the test tool url:
http://d1k5ny0m6d4zlj.cloudfront.net/diag/CFStreamingDiag.html
s3dbhkulzq9ndp.cloudfront.net
teaser.f4v (ok)
EM2_H264.f4v (NOT ok)
StreamLen Response: 0 ??
Received an answer from AWS team member
Posted by: RonS#AWS
Posted on: Oct 10, 2011 7:29 AM
https://forums.aws.amazon.com/message.jspa?messageID=284676
Hi, I downloaded both of your video objects and ran flvcheck (http://help.adobe.com/en_US/FlashMediaServer/3.5_AdminGuide/WS5b3ccc516d4fbf351e63e3d119f29261b7-7ffc.html) against them.
The teaser.f4v is apparently OK according to flvcheck, but EM2_H264 gets this:
11-10-10 07:10:25 Error: -26 File appears to be FLV with wrong extension. EM2_H264.f4v
If I rename the file to have a .flv extension, I get "Found backward timestamp".
I suspect the FMS software we're using will have the same complaints about that file that flvcheck does.
flvcheck is available for download here (you'll need to register with Adobe): http://www.adobe.com/products/flashmediaserver/tool_downloads/

Resources