You are not logged in.

#1 2012-10-26 01:05:23

dragos240
Member
Registered: 2009-05-23
Posts: 189

Game streaming?

Hello,

I've been messing about using justin.tv for streaming with success. I've modified a script I found on youtube, and it works very well for streaming your desktop:

ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+0,0 -itsoffset 00:00:01 -f alsa -ac 2 -i pulse -vcodec libx264 -s "$OUTRES" -pix_fmt yuv420p -acodec libmp3lame -ar 44100 -threads 6 -qscale 5 -b 256k -f flv "rtmp://live.justin.tv/app/$STREAM_KEY"

The original used -ab vs -ar and -vpre. I found that the resulting command streamed, and audio came out, but there was no video, adding -pix_fmt yuv420p fixed this issue.

So now I'm having a different problem. That problem is streaming a game. I want to run through Doom III to show how awesome it is to my friends. My problem is that  when I play games fullscreen games (I've only tested fullscreen), the game flickers. Here's a video of the issue:

http://www.justin.tv/dragos240/b/336876096

Also, having issues with my mic, though that's for another topic in another subforum.

I had thought of using GLC for game recording. I used it to record portal a few years back with no issues whatsoever. I had many issues recently, however. GLC is no longer maintained and I struggled to get it to work with my 64 bit machine. It's working now. My idea is to pipe the video from GLC to ffmpeg for encoding and streaming, though I'm not sure how to do that.

If anyone could give me some suggestions on how to maybe fix this, let me know.

Thanks,
Dragos

Offline

#2 2012-10-26 01:39:59

Xaero252
Member
Registered: 2011-11-28
Posts: 107

Re: Game streaming?

Interesting, I haven't had any issues with video flickering on my system using a similar (albeit different script) which can be found here: https://bbs.archlinux.org/viewtopic.php … 1#p1181831
The settings are similar, but different. I do remember while I was testing I had some similar issue, but it was always when using recordmydesktop; I think I only had output like that once with ffmpeg - and after rebooting the issue went away.

You can see some example footage here none of this is professional grade, I was just testing the script mostly:
http://www.twitch.tv/Theroxis

Last edited by Xaero252 (2012-10-26 01:43:05)

Offline

#3 2012-10-26 10:33:02

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: Game streaming?

Hello again,

Have you streamed recently? That script doesn't look like it works with the current version of ffmpeg. The footage I see here is mostly desktop recording. I have a hunch that a fullscreen game will do something funky. I appreciate the feedback. Let me know if you can record a game with your current script, fullscreen. Say maybe Q3A. I have Q3A (untested) and doom3 demo installed. Taking your username into consideration, I think you may play Q3A. If you and I cannot find an issue with that game running fullscreen, perhaps it's an issue with Doom 3, in which case, we've narrowed the problem down to the game.

Thanks,
Dragos

Offline

#4 2012-10-26 11:25:00

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,457

Re: Game streaming?

Just guessing... did you tried to disable compositing?


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2012-10-26 12:12:52

Xaero252
Member
Registered: 2011-11-28
Posts: 107

Re: Game streaming?

http://www.twitch.tv/theroxis/b/336667841
There you go, full composited compiz-standalone as wm, running WoW via wine using -opengl flag. no flickering. Recording took place Oct 24th, 2012.

Interesting to note, and I believe this is unrelated - but all of a sudden now when I record (using the exact same script) my video is only black, both local and remote - going to try ffmpeg from the aur.

Edit: D'oh! I forgot I had a secondary X server running at 0:0 for testing purposes with absolutely NOTHING DISPLAYED ON IT (convenient, eh?) no wonder I was recording black video... *rolleyes*

Okay, so I'm now currently streaming on the computer I original streamed on - using mic as input, I can use pasystray to switch between mic and monitor audio, and I can mix mic/monitor using pulseaudio loopback and pulseaudio null (which results in garbled audio for whatever reason) or you can setup Jack and mix the two streams that way and have perfect audio.

Last edited by Xaero252 (2012-10-26 12:42:15)

Offline

#6 2012-10-26 23:06:41

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: Game streaming?

Thanks, Xaero,

Also, kokoko, I have disabled compositing in case that was the cause, it was not, unfortunately.

I was wondering if recording fullscreen was the problem, and for whatever reason, it IS:
http://www.justin.tv/dragos240/b/336979320

As you can see, when the game is put into fullscreen mode, flicker occurs, however when it's simply maximised, the problem is no longer present. Xaero, you had the window maximised, but not fullscreen, which may explain why it's working for you. Because of e17, I can't just maximise the window because the menu-bar gets in the way (along with the window border). Can you try putting the game in fullscreen mode and see if everything still works without issue?

Thank you,
Dragos

Offline

#7 2012-10-27 12:33:07

Xaero252
Member
Registered: 2011-11-28
Posts: 107

Re: Game streaming?

What window manager do you use?
I was able to replicate your issue using "Unredirect Fullscreen Rendering" which I toggled on to stop a severe performance issue it causes with XBMC (I have two displays, each with a dedicated GPU; the secondary display is a TV and runs XBMC now; the performance drop with XBMC was huge so I decided to enable it, and low and behold - the flickering you spoke of has arisen)

This can be enabled under general options in ccsm. Hard to say for other compositing WMs if the feature is even an option.

Worth documenting:

Although CCSM doesn't appear to apply settings to each screen seperately for some reason, if you edit the configuration directly, you can add seperate lines for S0 and S1 for unredirect so that you can continue to stream without flicker on one screen, and remove the performance degradation on another (for most games I've played the off-screen rendering -> VFBO copy doesn't seem to hurt performance (1-5fps in most situations) although I may try it again with Crysis2 which seemed to have relatively poor performance.

The configuration file is located at ~/.config/compiz/compizconfig/Default.ini
Under the section [core]
I have placed

s1_unredirect_fullscreen_windows = true
s0_unredirect_fullscreen_windows = false

This has worked perfectly.

Last edited by Xaero252 (2012-10-27 12:42:23)

Offline

#8 2012-10-27 13:20:43

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: Game streaming?

Interesting. I use e17 (enlightenment 0.17 svn) right now. I do not use compiz nor compositing software. Maybe I'll just switch to MATE. I really have a thing for lightweight, simple WMs. I never seem to find one that really feels nice, though. E17 is annoying me a little because of how the window list works, it only displays minimised windows. The problem with this is that if I have a window in fullscreen mode (like a browser), I need to minimize my current window to view windows behind it, which can get tedius. I used openbox for a time too, and it worked nicely, but felt a little TOO simple. I used DWM for months, I really liked using that, the reason I left was because a lot of programs I used didn't like working with tiling WMs.

Offline

#9 2012-10-27 13:51:05

Xaero252
Member
Registered: 2011-11-28
Posts: 107

Re: Game streaming?

Before you go and switch WMs; know that the reason the setting exists is because I run a compositing WM. Its UNredirect for a reason. A normal window manager doesn't redirect the fullscreen windows to begin with. Compiz and all other compositing window managers do. I'm not sure of a way to fix the flicker issue on a non-compositing window manager. I will probably have to look into it, as the performance loss from redirecting fullscreen windows and the small delay are a slight nuisance.

I enabled vsync & triple buffering in the game, and this seemed to help but I still get the "flickering" in a much reduced fashion. It appears to be similar to screen-tearing in all actuality. I.e. x11grab is grabing a frame that isn't fully rendered. even more noteworthy is that it also appears to affect 2d rendered objects in games more than 3d rendered objects. For example, a texture rendered on a surface doesn't flicker, but a ui element does.

A temporary workaround (for you at least, since taking the application out of true fullscreen seems to work) could be to use wmctrl to toggle the fullscreen option:

wmctrl -x -r Doom 3 -b toggle,fullscreen

Replace "Doom 3" with whatever the window's actual name is. basically it just removes window decorations and resizes the window to your current display resolution. You still retain the ability to alt-tab rapidly and all of that such. Might work for you.

Last edited by Xaero252 (2012-10-27 14:21:57)

Offline

Board footer

Powered by FluxBB