iOS H264 Encoder Profile and Resolution

457 views
Skip to first unread message

Vishal Dalsania

unread,
Oct 8, 2019, 11:36:09 AM10/8/19
to discuss-webrtc
Hi,

Where do i set encoder settings for iOS H264 encoder.

RTCVideoEncoderH264.mm says that

The user must initialize the encoder with a resolution and framerate conforming to the selected H264 level regardless.

However, there is no documentation on how to provide that information to encoder.

I am creating encoder via below code

let videoEncoderFactory = RTCDefaultVideoEncoderFactory()
videoEncoderFactory.createEncoder(.init(name: "H264"))

Please help on how to specify H264 high profile and resolution of the video.

Thanks

Vishal Dalsania

unread,
Oct 8, 2019, 2:20:48 PM10/8/19
to discuss-webrtc
Anyone ?

Nagamuni reddy

unread,
Oct 8, 2019, 2:29:28 PM10/8/19
to discuss...@googlegroups.com
What exactly you want to achieve with this?
There are different ways to give encoding methods.. u can just give outside the frame work.. or u can disable inside the source code.. depending on you necessity.!

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/2cc916a2-595e-4bf6-b268-24b0bb57b9c4%40googlegroups.com.

Vishal Dalsania

unread,
Oct 8, 2019, 3:47:20 PM10/8/19
to discuss...@googlegroups.com
I am trying to screencast and framework automatically selects H264 Baseline profile on iOS and that fails H264 encoder because frame size is bigger than it can handle.

I want to provide resolution, fps to encoder so it can select correct h264 profile based on resolution and fps combination.

Wesley Lee

unread,
Oct 9, 2019, 12:07:45 AM10/9/19
to discuss...@googlegroups.com
Hi, 
when you create capturer, you can set w*h*fps params.
my code snapshot FYI.
//capturer
static int g_used_video_width = 640;
static int g_used_video_height = 480;
//encode
static int g_used_video_fps = 15;
static int g_used_video_maxqp = 30;
...
g_video_capturers = webrtc::VcmCapturer::Create(g_used_video_width, g_used_video_height,g_used_video_fps,cameraId);
webrtc::VideoCodecH264 h264_settings = webrtc::VideoEncoder::GetDefaultH264Settings();
encoder_config.encoder_specific_settings = new rtc::RefCountedObject<webrtc::VideoEncoderConfig::H264EncoderSpecificSettings>(h264_settings);
encoder_config.video_stream_factory = new rtc::RefCountedObject<cricket::EncoderStreamFactory>("H264", g_used_video_maxqp, g_used_video_fps, false, false);

g_video_send_stream = g_call->CreateVideoSendStream(std::move(video_send_config), std::move(encoder_config));
if (g_video_send_stream != nullptr)
{
	RTC_LOG(LS_INFO) << __FUNCTION__ << " , Success!";
	//kDegradationDisabled,kMaintainResolution,kMaintainFramerate,kBalanced,
	g_video_send_stream->SetSource(g_video_capturers, webrtc::VideoSendStream::DegradationPreference::kBalanced);
	return 0;
}

Vishal Dalsania <vishal....@rigelnetworks.com> 于2019年10月9日周三 上午3:47写道:

Vishal Dalsania

unread,
Oct 9, 2019, 2:30:23 AM10/9/19
to discuss-webrtc
This looks like using C++ native code.

Is there any way to specify these in iOS sdk ?
To unsubscribe from this group and stop receiving emails from it, send an email to discuss...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages