How can I change the Ant Media Server WebRTC resolution? - webrtc

I'm sending video from OBS Studio to Ant Media Server at 1280x720, but the WebRTC embed iframe is serving it at 560x315. How can I make the latter match the former?

You can change WebRTC stream resolution by editing media constraints in /usr/local/antmedia/webapps/YOUR_APP/index.html file. For example, to make 360x240 you can set media constraint as:
var mediaConstraints = {
video : {width: 360,height: 240},
audio : true
};
You may also want to change video bitrate proportional to the resolution settings. You can pass bandwidth parameter of webrtcAdaptor bandwidth: value or max bandwidth: "unlimited". It's default 900 kbps.

I understand that I can resize the iframe, but when I do that it doesn't change the size of the video stream coming from Ant Media Server. How do I change that resolution?

Related

OpenTok TokBox: Video in vertical presentation looks like in horizontal presentation after archiving

Our aim is to show portait video (vertical orientation in terms of TokBox) without black areas right and leftside after archiving. Now it looks like landscape with black areas on right and left side.
We are using php server and android client for streaming.
Our steps to convert live stream in video on demand through archieving are:
start session
update stream with the parameter layoutClassList = verticalPresentation (php library)
start archieving
live stream is on -> create subsriber and watch the stream. IMPORTANT! The stream has no black areas and has CORRECT presentation on subsriber side!
stop archieving
waiting TokBox upload archieving file to Amazon s3 bucket -> the file ALREADY contains black areas right-leftside. WRONG! (please watch the video on link for better understanding https://s3-us-west-1.amazonaws.com/edtv-dev1-input/46176492/9f26ef23-aee6-42f2-8c51-d8e2685abcc9/archive.mp4 )
processing the file
Are thereabove the correct steps to achieve the goal - get video file without black areas (in portrait orientation)? Are we missing anything?
Is archieving process on TokBox sensitive to horizontal/vertical presentation? is it possible to archive the video in vertical orientation?
UPDATE: What we wanted was not composed, but INDIVIDUAL stream! TokBox creates zip file, but Amazon AWS was able to transcode it and get the correct result both in portrait and landscape orientations.
NOTE: As a default result file on Amazon AWS after Individual stream archiving is *.zip (json + video file in it). The trascoder we used gave us video without sound. So we added lambda that unzipped the file. Now everything is ok, but took a lot of time and headache.
Tokbox developer here
For composed archiving, the only two options currently available for output resolution are 640x480 and 1280x720. Trying to fit a portrait video into a canvas of the available resolutions will result in the video you are seeing.
Possible solutions:
Use the custom layout control [1]: you can override the "object-fit" property to "cover". This may not result in exactly what you want, since the output resolution will still be 640x480 or 1280x720, but the video will occupy the whole canvas, at the expense of cropping the top and bottom part. See [2]
The best solution in my opinion is to use "individual stream archiving", where the resolution will be kept as the original, and you get a file per stream. Please check [3]
https://tokbox.com/developer/guides/archiving/layout-control.html
https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
https://tokbox.com/developer/rest/#start_archive
How can we get URL within the zip created by opentok which was uploaded in s3

Selecting high bit rate video from master playlist .m3u8 to play video using AVPlayer

I have mater playlist .m3u8 that files contain's other index file of type .m3u8 now app requirement's is to play video of high bit rate video, is it possible to achieve this and play high bit rate video using AVPlayer(apple tvOS).
Master playlist contains following index files
EXTM3U
EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=378000,RESOLUTION=256x144,CODECS="avc1.42001e,mp4a.40.2"
someurl.m3u8
EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2072000,RESOLUTION=480x270,CODECS="avc1.42001e,mp4a.40.2"
someurl.m3u8
EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2671000,RESOLUTION=640x360,CODECS="avc1.4d001f,mp4a.40.2"
someurl.m3u8
Now according to requirement app needs to play below url from master play list.
ID=1,BANDWIDTH=2671000,RESOLUTION=640x360,CODECS="avc1.4d001f,mp4a.40.2"
someurl.m3u8
Is it possible to achieve this using AVPlayer.
Setting
player.currentItem?.preferredPeakBitRate = 2072000
only sets an upper bound on bitrate, so for example you could exclude the highest bitrate using this.
The thing is, AVFoundation will not choose a bitrate that is higher than the network connection's throughput, because that would result in choppy playback, which is not a sensible strategy.
That said, if you really want to force playback of the highest bitrate asset, you could intercept the fetching of the outer m3u8 file and suppress the lower bitrate entries, or parse the file and play the highest bitrate URL directly with AVPlayer.

WebRTC: View self-view while muting outgoing video in a call

Currently, the video mute functionality in webrtc is achieved by setting the enabled property of a video track to false
stream.getVideoTracks().forEach(function (track) {
track.enabled = false;
});
But the above code would not only mute the outgoing video, but the local self-view which is rendered using that local stream, also gets black frames.
Is there a way, to ONLY mute the outgoing video frames, but still be able to show a local self-view?
There's no easy way yet. Once MediaStreamTrack.clone() is supported by browsers, you could clone the video track to get a second instance of it with a separately controllable mute property, and send one track to your self-view and the other to the peerConnection. This would let you turn off video locally and remotely independently.
Today, the only workarounds I know of would be to call getUserMedia twice on Chrome (should work on https at least, where permissions will be persisted so the user won't be prompted twice) which would get you two tracks you could video-mute independently, or on Firefox you could use RTCRtpSender.replaceTrack() with a second "fake" video stream from getUserMedia using the non-standard { video: true, fake: true } constraint like this.

recording a remote webrtc stream with RecordRTC

I am using Opentok JavaScript WebRTC library to host a 1-to-1 video chat (peer-to-peer).
I can see my peer's video and hear the audio flawlessly.
My wish is to record audio / video of other chat party (remote). For this purpose, I'm using RecordRTC.
I was able to record the video of other chat participant (video is outputted to HTML video element), but, so far, I have not succeeded in recording audio (a dead-silence .wav file is as far as I could get). Using Chrome Canary (30.0.1554.0). This is my method:
var clientVideo = $('#peerdiv video')[0];//peer's video (html element)
var serverVideo = $('#myselfdiv video')[0];//my video (html element)
var context = new webkitAudioContext();
var clientStream = context.createMediaStreamSource(clientVideo.webRTCStream);
var serverStream = context.createMediaStreamSource(serverVideo.webRTCStream);
webRTCStream is a custom property i assigned to HTMLVideoElement object by modifying source of opentok js library. It contains MediaStream object linked to respective < video > element.
var recorder = RecordRTC({
video: clientVideo,
stream: clientStream
});
recorder.recordAudio();
recorder.recordVideo();
Video is recorded. Audio file is also created, it has a length that is close to video's length, however, it's completely silent (and yes, there was a lot of noise making on the other side during recording)
I've tested this with video element which displays my webcam's video stream (and audio), and it worked: both audio and video were recorded:
...
var recorder = RecordRTC({
video: serverVideo,
stream: serverStream
});
...
Is there something special about streams originating from a remote location? Any guidance on this issue would be very helpful.
This is the same issue occurs in following situations...
If not a stereo audio (dual channel audio)...i.e. it is mono audio
If audio input channels are not equal to audio output channels
If audio input device is not the default device selected on chrome
I'm still trying to find the actual issue.
I added this experiment for testing purpose... see console...
https://webrtc-experiment.appspot.com/demos/remote-stream-recording.html
Updated at: Saturday, 1 February 2014, 09:22:04 PKT
Remote audio recording is not supported; and this issue is considered as low-priority wontfix:
Support feeding remote WebRTC MediaStreamTrack output to WebAudio
Connect WebRTC MediaStreamTrack output to Web Audio API
Updated at March 28, 2016
Remote audio+video recording is now supported in RecordRTC, since Chrome version 49+.
Firefox, on the other hand, can merely record remote-audio.
If Chrome/WebRTC/Opus outputs mono audio by default and if that is the problem here, I see two options in that case:
By making opus output stereo - not sure how.
By making the RecordRTC/Recorderjs code work with mono
Or does anyone know any other recording library that works?
This actually now works fine in Firefox. I am using FireFox 29.0.1 and the AudioAPI can now work with audio streams sources grabbed from remote parties from a peer connection.
To test go to Muaz Khan's experiment page. I am not sure with what version of Firefox this rolled out but I would like to thank the team for cranking it out!
The chrome bug was moved to the AudioAPI team cr bug to track progress

Can I force Flash use for MP4 playback?

I want to abandon the HTML5 video tag for a 8MB MP4 file I want to play on a webpage because it has been doing strange things on Chrome on Windows 7/8 but not on Chrome <=Vista. Strange as in:
Not loading it sometimes
Most of the time but not always vertically squashing the video content 70%
Flickering wildly
This has been duplicated on a number of different machines we have tested on.
Is there some markup I could use to force an MP4 to be played by Flash only?
TIA
Mark
You can make the player use Flash using the techOrder parameter.
<video ... data-setup='{"techOrder": ["flash"]}' ... />
https://github.com/videojs/video.js/blob/master/docs/guides/tech.md
If you want to give the priprity to flash player first go to the video.js or video.min.js file and replace the ["HTML5"],["flash"] with ["flash"],["HTML5"]
Try to replace
vjs.options = {
// Default order of fallback technology
'techOrder': ['html5','flash'],
with
vjs.options = {
// Default order of fallback technology
'techOrder': ['flash','html5'],
in video.js. The script will now give flash the priority to run, rather then html5