3

If I am streaming from android webrtc SDK (provided by antmedia) to community edition of Ant Media, the final video which is being saved, appears stretched (shot in portrait mode of mobile). Check the screenshot of the video. But if I am using the enterprise edition, the problem resolves itself.

Kindly help, how can I prevent the video stretching (while saving) in community edition?

  • Thank you for asking this question. I think this problem happens because Ant Media Server Community Edition resizes the incoming video to 640x480. The origin video's resolution is likely 16:9 so that you see a stretching in the video. – faraway Aug 07 '20 at 07:45

1 Answers1

2

I think this problem happens because Ant Media Server Community Edition resizes the incoming video to 640x480. The origin video's resolution is likely 16:9 so that you see a stretching in the video.

I think you can set the resolution to something 4:3 in Android SDK because community edition uses 640x480 for converting WebRTC stream. Try the followings before you initialize webRTCClient = new WebRTCClient( this,this); in onCreate method

  this.getIntent().putExtra(EXTRA_VIDEO_WIDTH, 640);
  this.getIntent().putExtra(EXTRA_VIDEO_HEIGHT, 480);

Update:

There is an aspect ratio problem in community edition while publishing from Mobile App. The issue is created for that. https://github.com/ant-media/Ant-Media-Server/issues/2492

Fortunately, commits are also pushed to resolve this problem. It'll be available as SNAPSHOT soon and will be available in next release. SNAPSHOTs are here -> https://oss.sonatype.org/#nexus-search;gav~io.antmedia~ant-media-server~~~~kw,versionexpand

faraway
  • 1,491
  • 10
  • 22
  • 1
    How can the same problem be solved in iOS? Kindly tell the steps to fix the issue in iOS webrtc SDK as well. – Anoop Kumar Pandey Aug 08 '20 at 05:45
  • Good question. There is a method in iOS SDK with name `setTargetResolution` You can specify width and height there and try again. https://github.com/ant-media/Ant-Media-Server/wiki/WebRTC-iOS-SDK-Reference – faraway Aug 09 '20 at 07:56
  • `setTargetResolution` is overriden in `startCapture()` method of `WebRTCClient.swift` in which it is matched with the nearest `AVCaptureDevice.Format`. Tried multiple combinations and it didn't work. Tried this (https://stackoverflow.com/questions/38089336/ios-how-to-change-video-resolution-in-webrtc) also, but didn't work. – Anoop Kumar Pandey Aug 09 '20 at 14:06
  • Just now checked the suggestion for Android. That didn't work either. Kindly check yourself. – Anoop Kumar Pandey Aug 10 '20 at 05:22
  • Do you see output log of the below line in android? Logging.d(TAG, "startCapture: " + width + "x" + height + "@" + framerate); If yes and it's not 640x480, it means your device camera may not support 640x480. You may try some other 4x3 ratios – faraway Aug 11 '20 at 09:24
  • In iOS side, it tries to find the closest resolution in startCapture method. – faraway Aug 11 '20 at 09:27
  • I don't think it's iOS or android problem or camera support problem. The question states clearly that the issue occurs only when we use community edition, not the enterprise edition. – Anoop Kumar Pandey Aug 13 '20 at 10:42
  • Checked in android: startCapture: 640*480@30fps [1]: https://i.stack.imgur.com/Glvn5.jpg. No problem there. – Anoop Kumar Pandey Aug 14 '20 at 05:32
  • Sorry for late reply. Because it's in community edition. We give support as best effort. I'm checking for now. – faraway Sep 11 '20 at 06:49
  • Yeah I've encountered some problems in Android SDK and community edition. Because generally it's designed for Enterprise edition. Anyway I'll try to make it work. – faraway Sep 12 '20 at 08:11