Custom encoder

Various experience with applications based on Live Server

Custom encoder

Postby dabinn » Wed Jul 22, 2015 9:25 am

Hi,
I got problem setting up x264vfw as custom encoder in Live server.

In Custom encoder configuration dialog
Encoder DirectShow name: x264vfw - H.264/MPEG-4 AVC codec
Config component ProgID: (Leave empty)

When test with "Preview live source", server error dialog pop-out immediately: "Live source initialization timed out"

Any idea?
dabinn
 
Posts: 0
Joined: Wed Jul 22, 2015 8:15 am

Re: Custom encoder

Postby admin » Wed Jul 22, 2015 10:14 am

Same or similar error messages here; this codec cannot be used as of now - some DirectShow incompatibility issues.
They probably did not implement DirectShow properly; this codec is even named vfw: Video For Windows, so its' primary purpose is not DirectShow.

Besides, the Live Server has a built-in h.264 codec which is also based on x264, so there is absolutely no benefit of using that codec.
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Custom encoder

Postby dabinn » Wed Jul 22, 2015 11:17 am

Thank you for the quick response.
I've tested the build-in H.264 encoder, both performance and quality are not good.
Comparing to capture with ffmpeg or OBS, and send streaming to media server via rtmp.
Both ffmpeg and OBS has good video quality and CPU usage is low (30~60% with Intel I3).
But encoding H.264 with live server, CPU usage is about 70~95% (video is 1080p@30fps), the streamed video is choppy , mosaic all the time.
So I think use custom encoder may be better.
dabinn
 
Posts: 0
Joined: Wed Jul 22, 2015 8:15 am

Re: Custom encoder

Postby admin » Wed Jul 22, 2015 12:26 pm

How can the quality be different if the same x264 codebase is used, with the same bitrate/framerate/framesize?
Note that by default Unreal Live Server encodes with high h.264 profile, level 3.1. High profile consumes more CPU, for sure, than baseline or main profiles.
To compare, you need to make sure that absolutely all codec parameters are the same: bitrate, frame rate (real framerate), frame size, profile, level, codec settings.

A different thing is: ffmpeg/OBS may be using libx264 with GPU-based encoding turned on, then yes, CPU will be less busy.
But that doesn't guarantee that the quality will be better, please read on GPU at
https://trac.ffmpeg.org/wiki/Encode/H.264.

The source code for our built-in codec is available at
http://www.umediaserver.net/bin/UXH264_Source.zip
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Custom encoder

Postby admin » Wed Jul 22, 2015 12:54 pm

Also, note that the performance of Unreal Live Server h.264 encoding is similar in CPU consumption to the performance of Adobe FMLE for the same framerate/framesize/bitrate, level/profile, with same/better quality. Check for yourself.
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Custom encoder

Postby dabinn » Wed Jul 22, 2015 1:06 pm

I have tried various settings include baseline profile, level 1.0 & level 4.0, high bitrate and low bitrate, none of them can produce a smooth streaming video at 1080p, the only way to make the video smooth is half the resolution, 960x540.
But with ffmpeg and OBS, I can easily get good and smooth video.
I noticed that OBS has a "CPU Usage Preset" setting, and ffmpeg has a "-preset" switch. It can be set from ultrafast, superfast to medium, slow....etc. This affect the encoding speed and CPU usage very much. I use "superfast" in both program, and feel satisfy with the video quality.
I didn't find the preset setting in Unreal Live Server , does it not provided ?
dabinn
 
Posts: 0
Joined: Wed Jul 22, 2015 8:15 am

Re: Custom encoder

Postby dabinn » Wed Jul 22, 2015 1:16 pm

I think the quality issue may be the low power CPU (Intel I3) causes frame loss, then the video laggy and mosiac.
I checked the properties in Streaming Media Player while video playing, when encoding with ffmepg/OBS, the frame rate is always 30~31fps.
But with Live server, only 24~27fps of frame is recieved.
dabinn
 
Posts: 0
Joined: Wed Jul 22, 2015 8:15 am

Re: Custom encoder

Postby admin » Wed Jul 22, 2015 1:47 pm

Unreal Live Config does not provide similar presets to these in ffmpeg.

Well, if you don't like the quality, you can really use another rtmp-pushing encoder like OBS or another DirectShow-compatibe codec in Live Server.
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Custom encoder

Postby dabinn » Wed Jul 22, 2015 2:27 pm

I like your live server, because by using "static live broadcast", the live server only capture and encode when video is requested. Very sweet :D
If I use ffmpeg with rtmp, the capture need to be turn on all the day.

I have record 2 videos for your reference. Please notice the CPU usage at the right monitor(server), and watch the bitrate, fps at the properties page of Streaming Media Player at the left monitor(client PC).

video 1: Live server vs ffmpeg
Encoding with With live server, CPU usage is nearly full, fps is low(frame drops), the bitrate show in media player is nearly the same with ffmpeg.
ffmpeg is smoth, with no frame drop.
https://www.youtube.com/watch?v=LIWRW0d7BO0

video 2: lower the bitrate of Live server
Lower the bitrate will lower CPU usage, but CPU usage still high, video quality is not acceptable.
De-Interlace option is not turn on, if on, fps will drops to below 10fps
https://www.youtube.com/watch?v=LIWRW0d7BO0

ffmpeg setting:
-video_size 1920x1080 (same)
-framerate 30 (same)
-vcodec libx264
-preset ultrafast
-tune zerolatency
-maxrate 750k
-vf "yadif" (de-interlace is ON)
dabinn
 
Posts: 0
Joined: Wed Jul 22, 2015 8:15 am

Re: Custom encoder

Postby dabinn » Wed Jul 22, 2015 2:29 pm

dabinn
 
Posts: 0
Joined: Wed Jul 22, 2015 8:15 am

Next

Return to Live applications

Who is online

Users browsing this forum: No registered users and 0 guests

cron