Performance problems with simultaneous transcoding for livehttp

About encoding, codec settings, muxers and filter usage
Ghengis
Blank Cone
Blank Cone
Posts: 17
Joined: 10 Apr 2008 15:14

Performance problems with simultaneous transcoding for livehttp

Postby Ghengis » 05 Jun 2018 13:06

I will eventually have a live video feed coming in that I'd like to publish via HLS in a few different bitrates. During initial development, I've been trying to figure out transcoding using VLC just working from a single local file, under the assumption that I can easily replace the input later. (I say this here for context, in case transcode-from-file is somehow fundamentally different from transcode-from-stream.)

I've gotten as far as this:

Code: Select all

"c:\program files\videolan\vlc\vlc-gpu.exe" -I dummy "c:\users\James\Downloads\bbb_sunflower_2160p_60fps_normal.mp4" --sout=#duplicate{dst={transcode{height=540,fps=15,vcodec=h264,vb=800,venc=x264{aud,profile=baseline,keyint=30},acodec=aac,ab=96,threads=4}:std{access=livehttp{seglen=4,delsegs=false,numsegs=0,index=c:\workspace\vidtest\bbb540.m3u8,index-url=bbb540-#####.ts},mux=ts{use-key-frames},dst=c:\workspace\vidtest\bbb540-#####.ts}},dst={transcode{height=720,fps=30,vcodec=h264,vb=2200,venc=x264{aud,profile=baseline,keyint=60},acodec=aac,ab=128,threads=4}:std{access=livehttp{seglen=4,delsegs=false,numsegs=0,index=c:\workspace\vidtest\bbb720.m3u8,index-url=bbb720-#####.ts},mux=ts{use-key-frames},dst=c:\workspace\vidtest\bbb720-#####.ts}},dst={transcode{height=1080,fps=60,vcodec=h264,vb=3200,venc=x264{aud,profile=baseline,keyint=120},acodec=aac,ab=192,threads=4}:std{access=livehttp{seglen=4,delsegs=false,numsegs=0,index=c:\workspace\vidtest\bbb1080.m3u8,index-url=bbb1080-#####.ts},mux=ts{use-key-frames},dst=c:\workspace\vidtest\bbb1080-#####.ts}}}
It seems to work well, all three sets of files are being generated at the same time, but performance is pretty bad. The output files are being written at around half or less the real-time playback speed, with 4-second segments showing up every 10+ seconds. That would be fine if the hardware just couldn't keep up, but in Task Manager, my CPU usage hovers around 30% and GPU around 50%. As you can see in the script, I'm telling each transcode to use 4 threads, and I've forced VLC to use my GeForce 1060 instead of the Intel iGPU (though according to Task Manager it doesn't make much difference, in terms of percentage load).

Is there something I'm missing here? I'd like to use "all the hardware" if possible. I'm trying to get a feel for how much I can transcode in real-time on a given set of hardware, but if half the cores are always sitting idle, it seems like that could be put to better use.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Performance problems with simultaneous transcoding for livehttp

Postby Jean-Baptiste Kempf » 26 Jun 2018 20:56

What are your VLC logs?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Ghengis
Blank Cone
Blank Cone
Posts: 17
Joined: 10 Apr 2008 15:14

Re: Performance problems with simultaneous transcoding for livehttp

Postby Ghengis » 27 Jun 2018 09:19

What log level should I capture? I can run it for a little while and upload the results here, if that helps. You could also run the command yourself, the sample I'm transcoding is the 4K render of Big Buck Bunny available from Blender: http://bbb3d.renderfarming.net/download.html . Let me know which you'd prefer.

User avatar
InTheWings
Developer
Developer
Posts: 1275
Joined: 07 Aug 2013 13:15
VLC version: crashing
Operating System: Linux
Contact:

Re: Performance problems with simultaneous transcoding for livehttp

Postby InTheWings » 27 Jun 2018 09:45

If multiple streams are encoded at the same time, try disabling hw acceleration (yes, that sounds wrong, i know)
:!: If you want your problem to be solved :
* First read troubleshooting guide VSG:Main
* Always provide verbose LOGS ! (command line or from gui)
* Always check your issue against a developer build from Nightly Build of VLC
* Tell us when your problem is solved !

Ghengis
Blank Cone
Blank Cone
Posts: 17
Joined: 10 Apr 2008 15:14

Re: Performance problems with simultaneous transcoding for livehttp

Postby Ghengis » 27 Jun 2018 10:03

Which hardware flag would that be? I see a few different ones in the command line reference.

User avatar
InTheWings
Developer
Developer
Posts: 1275
Joined: 07 Aug 2013 13:15
VLC version: crashing
Operating System: Linux
Contact:

Re: Performance problems with simultaneous transcoding for livehttp

Postby InTheWings » 27 Jun 2018 10:34

--avcodec-hw=none
:!: If you want your problem to be solved :
* First read troubleshooting guide VSG:Main
* Always provide verbose LOGS ! (command line or from gui)
* Always check your issue against a developer build from Nightly Build of VLC
* Tell us when your problem is solved !

Ghengis
Blank Cone
Blank Cone
Posts: 17
Joined: 10 Apr 2008 15:14

Re: Performance problems with simultaneous transcoding for livehttp

Postby Ghengis » 27 Jun 2018 11:46

That flag does reduce GPU usage to 0, and increase CPU usage somewhat, but it still won't go over 45% (typically 35-40%) with the command in the OP. It's taking around 20 seconds (!) to produce a 4-second segment. Well, 3 4-second segments, but you get the idea.

I logged a few files' worth of output, hosted in this gist. (Can I maybe attach logs here in the forum somehow?)

User avatar
InTheWings
Developer
Developer
Posts: 1275
Joined: 07 Aug 2013 13:15
VLC version: crashing
Operating System: Linux
Contact:

Re: Performance problems with simultaneous transcoding for livehttp

Postby InTheWings » 27 Jun 2018 11:57

transcoding is non threaded by default
:!: If you want your problem to be solved :
* First read troubleshooting guide VSG:Main
* Always provide verbose LOGS ! (command line or from gui)
* Always check your issue against a developer build from Nightly Build of VLC
* Tell us when your problem is solved !

Ghengis
Blank Cone
Blank Cone
Posts: 17
Joined: 10 Apr 2008 15:14

Re: Performance problems with simultaneous transcoding for livehttp

Postby Ghengis » 27 Jun 2018 17:02

Does "threads=4" in the OP not mean what I thought it meant?


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 16 guests