Maarten Baert's website

Game Maker / C++ projects

Home Model Creator ExtremePhysics Game Maker DLLs SimpleScreenRecorder   Recent comments Search

Last modified: Sun, 28 Sep 2014
Refresh

Live streaming


Since SimpleScreenRecorder uses ffmpeg/libav libraries to handle the encoding and formatting, it can also make use of ffmpeg/libav's ability to do live streaming. Live streaming is not my highest priority, but if you're interested in streaming and you need some specific feature, feel free to contact me.

You will need a pretty powerful computer to do live streaming. When you're just recording a video, the codecs are configured for high performance, which will increase the bitrate but reduce the CPU load. But when you're doing live streaming, the bitrate should be as small as possible, so this can't be done. So unless you have a really powerful processor, you shouldn't try to record at high resolutions.

Hint

Unfortunately, the streaming support in ffmpeg/libav isn't nearly as robust as the rest of ffmpeg/libav. RTMP streaming (explained below) appears to be reliable, but many other protocols and containers are not. Don't be surprised if SimpleScreenRecorder closes or freezes without any explanation. Some useful hints:

  • Run SimpleScreenRecorder from a terminal, so you can see error messages produced by ffmpeg/libav or other libraries. These won't show up in the log in SimpleScreenRecorder.

  • Make sure you have a reliable internet connection. Avoid wireless if possible.

  • If you can't connect, check your firewall (for RTMP, ffmpeg/libav may kill the process without any error message if the connection is refused).

  • If possible, try to get the latest version of ffmpeg/libav (ffmpeg is preferred if you have a choice).

Container

Not all containers are suitable for streaming. Some containers (e.g. MP4) put important metadata at the end of the file, so if you try to stream those files, you won't see anything. Containers that are known to work are 'flv' and 'mpegts' (found under 'Other'). Matroska also appears to work, but not all players support it.

Note
  • In many cases, it takes some time before a stream starts playing, because the player has to wait for a keyframe. During this period you may even get error messages (e.g. complaining about missing frames). Wait at least 30 seconds before concluding that it doesn't work.

  • Some media players (VLC, ffplay) appear to be unable to play flv streams that have no audio.

Codecs

The codecs you can use are limited by the container that you're using. The most common codecs are H.264 for video and AAC for audio (this works for flv and mpegts).

If you're using H.264, SimpleScreenRecorder will by default use 'constant quality mode'. This means the bitrate will vary depending on the complexity of the video. This is great for normal recording, where you only care about the total file size, but not so much for live streaming. You can get around this by setting the codec to 'Other', and then choosing 'libx264'. This is the same codec, but now it will be used with a fixed bitrate, which is better suited for streaming.

Streaming services

You can stream to websites like twitch.tv and livestream.com if you know the RTMP URL.

  • Set the container to 'flv'.

  • Put the RTMP URL in the 'save as' field in SimpleScreenRecorder.

  • Uncheck 'separate file per segment'

  • Set the video codec to libx264 (not H.264, that one won't allow you to change the bit rate).

  • Set the bit rate to a reasonable value, for example 2000 kbps. The value should be significantly lower than the upload speed of your internet connection, otherwise it will not work well.

  • In the custom video codec options field, enter preset=fast,minrate=2000,maxrate=2000,bufsize=2000,keyint=60. The value of 'minrate', 'maxrate' and 'bufsize' should be equal to the bit rate. For more information about custom codec options, read this.

  • Set the audio codec to AAC.

twitch.tv

You can get a list of RTMP servers here (based on this). Pick one that's near you.

After picking a server, you should go your Twitch dashboard, log in, and click 'stream key'. Now click 'show key' to see your stream key. You then have to append this to the RTMP URL. Example:

rtmp://live-ams.twitch.tv/app/live_AgPUV1rXJnKm4Qg8

livestream.com

I haven't tested this, but this forum thread says that it's possible. The URL is:

rtmp://publish.livestream.com/mogulus/YOURCHANNELNAME/username=YOURUSERNAME/password=YOURPASSWORD/isAutoLive=true

The bandwidth is limited to 500kbps though (that's video and audio combined).

UDP streaming

This is probably the simplest way to do streaming, but it also has some serious downsides. UDP is an unreliable transport system: packets can go lost and this will lead to corrupted video. This is not a problem when you're streaming over your LAN where packet loss is extremely unlikely, but if you stream over the internet, or even over a wireless connection, you will probably lose some packets.

Since UDP is point-to-point, you can only play the stream on one computer, and you need to know the IP of that computer.

You can do UDP streaming by entering udp://ipaddress:port in the 'save as' field in SimpleScreenRecorder.

You can then receive this stream in a video player like VLC or MPlayer. In VLC you would do this by clicking Media > Open Network Stream and entering udp://@:port. With some containers (e.g. flv), you should start the player before you start streaming to receive anything at all, while with other containers (e.g. mpegts) you can start the player whenever you want.

Streaming with ffserver/avserver

There's a utility called ffserver/avserver that can act as a streaming server for ffmpeg/libav. Theoretically it should be possible to make this work with SimpleScreenRecorder, but I haven't figured out how. The program is a bit weird, instead of just re-streaming whatever ffmpeg/libav sends to it, it actually tells ffmpeg/libav what format and codec it should use, and I have no idea how SimpleScreenRecorder is supposed to react to that.

It doesn't really matter though, because the next method works perfectly.

RTMP streaming with nginx + RTMP module

This takes more time to set up, and it's not particularly easy, but I think it's worth it. You will need:

  • The nginx source code

  • The nginx RTMP module source code

  • Optionally, a flash player to embed the stream in a webpage, like Flowplayer. You can also use a media player like VLC, but it's easier to point people to a webpage.

    I don't particularly like flash, but there really are no good alternatives at this point (HLS comes close, but apparently the latency is a lot higher, and not all browsers support the same codecs).

The nice thing about RTMP is that the same protocol can be used not just to play a stream, but also to supply it. This means SimpleScreenRecorder can simply stream to rtmp://localhost:10200/live/nameofstream (just put that URL in the 'save as' field), and other clients will then be able to play that same URL. SimpleScreenRecorder doesn't need to act as a server and isn't exposed to the internet.

First you should set up the RTMP server. You have to compile nginx together with the RTMP module, instructions can be found at the github page for the RTMP module. Then you need to configure the server by modifying the nginx configuration file. All options are explained on the nginx and RTMP module websites. Here's the configuration that I used:

worker_processes 1;

events {
    worker_connections 100;
}

http {
    include mime.types;
    default_type application/octet-stream;
    server {
        
        listen 10201;
        
        location /live/ {
            try_files /live/live.html =404;
        }
        location = /stats {
            allow 127.0.0.1;
            deny all;
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
        
    }
}

rtmp {
    server {
        
        listen 10200;
        
        wait_key on;
        wait_video on;
        
        application live {
            
            live on;
            
            allow publish 127.0.0.1;
            deny publish all;
            
            allow play all;
            
        }
        
    }
}

This tells nginx to run an RTMP server on port 10200 and an HTTP server on port 10201. The HTTP server hosts an HTML page (/live/live.htm) and the flash player (Flowplayer). Here's a simple example of what the HTML page could look like:

<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../flowplayer-3.2.12.min.js"></script>
<title>Live video stream</title>
</head>

<body>

<h1>Live video stream</h1>

<div id="player" style="width:854px;height:480px"></div>

<p id="streaminfo"></p>

<script type="text/javascript">

m = location.href.match(/^http:\/\/([a-zA-Z0-9._-]+):[0-9]+\/live\/(.*)$/);
host = m[1];
name = m[2];

document.getElementById("streaminfo").innerHTML = "Streaming: <b>rtmp://" + host + ":10200/live/" + name + "</b>";

flowplayer("player", "../flowplayer-3.2.16.swf", {
    clip: {
        url: name,
        live: true,
        scaling: "fit",
        provider: "rtmp"
    },
    plugins: {
        rtmp: {
            url: "flowplayer.rtmp-3.2.12.swf",
            netConnectionUrl: "rtmp://" + host + ":10200/live"
        }
    }
});

</script>

</body>

</html>

Nginx is set up so that every URL starting with /live/ gets redirected to that page, and then that page simply uses javascript to read the full URL and decide what stream should be played. If you go to http://localhost:10201/live/nameofstream, it will stream from rtmp://localhost:10200/live/nameofstream.

You can also get statistics by going to http://localhost:10201/stats (you should get the stat.xsl file from the RTMP module source code).

You can also use other streaming servers (e.g. Red5), I'm pretty sure that those will work too.


Comments

Dubslow

Comment #1: Mon, 9 Sep 2013, 7:37 (GMT+1, DST)

Quote


I'm using this wonderful program to stream to Twitch, which requests both a reduced Keyframe Interval and a constant bit rate.

Following the directions, I set the codec to libx264 with a bitrate at or below 5000 -- but Twitch still sees a fluctuating bit rate, maxing at well over the given rate.

I additionally tried to set the Keyframe Interval to 2 seconds (down from 8+1/3) with "keyint=60" in the custom options bar, however, that appears to have had no effect.

Any thoughts?

Maarten Baert

Administrator

Comment #2: Mon, 16 Sep 2013, 15:13 (GMT+1, DST)

Quote


Quote: Dubslow

I'm using this wonderful program to stream to Twitch, which requests both a reduced Keyframe Interval and a constant bit rate.

Following the directions, I set the codec to libx264 with a bitrate at or below 5000 -- but Twitch still sees a fluctuating bit rate, maxing at well over the given rate.

I additionally tried to set the Keyframe Interval to 2 seconds (down from 8+1/3) with "keyint=60" in the custom options bar, however, that appears to have had no effect.

Any thoughts?

The custom options field currently only supports 'private codec options', as ffmpeg calls them. You can use it to set x264 presets and tunings (try 'preset=fast,tune=zerolatency'). Generic options like 'keyint' don't work yet, I still have to add that.

Bit rates will always fluctuate, this is normal and even required for efficient use of bandwidth. You can make the bit rate more flat (at the cost of some quality) with the 'VBV' options, which correspond to rc_max_rate and rc_buffer_size in ffmpeg, but as with 'keyint' these won't work yet because they are not private codec options.

I will try to add support for non-private options, but it's difficult because ffmpeg has a lot of options, and the list changes between versions.

Dubslow

Comment #3: Tue, 17 Sep 2013, 1:45 (GMT+1, DST)

Quote


Would it not be possible to just add the text in the box to the ffmpeg command? (Or do you directly call some ffmpeg API?)

As for Twitch, they ask for constant bit rate for reasons of internet architecture and bandwidth-restriction issues. They have a page with more information here.

Thanks again for the wonderful program!

Maarten Baert

Administrator

Comment #4: Thu, 19 Sep 2013, 18:56 (GMT+1, DST)

Quote


Quote: Dubslow

Would it not be possible to just add the text in the box to the ffmpeg command? (Or do you directly call some ffmpeg API?)

No, the ffmpeg command-line program is not used, I use the libraries directly. The libraries have a very different interface, unfortunately most of the options have different names and in some cases the names (or locations) have even changed between versions.

Quote: Dubslow

As for Twitch, they ask for constant bit rate for reasons of internet architecture and bandwidth-restriction issues. They have a page with more information here.

You have to realize that a perfectly constant bit-rate doesn't exist except for uncompressed streams. Even in CBR mode, you are going to see some variations over time. This is normal. If you set a bitrate in SimpleScreenRecorder, it will try to use that as the average bit rate, but it is possible that you will see peaks that are much higher than that. You can reduce the variations in bit rate with the VBV options I described, but this will greatly reduce the quality if you overuse it. And even then there are no guarantees.

Glog78

Comment #5: Thu, 17 Oct 2013, 19:15 (GMT+1, DST)

Quote


First of all thanx for the livestreaming option. It's the only way i get a synced audio video stream to twitch.
Still a few questions are left:
1) You mentione VBV Options above, can you describe the usage a little more ?

2) Can you please somehow implement that there is at least a max-bitrate which never get crossed -> i only have 768kb upload and even with the following custom options

preset=fast,tune=zerolatency,vbv-maxrate=600,qmax=51,qmin=10,vbv-bufsize=600

i get so high spikes that the stream stops working for viewers. Additional Information -> Scale Video is enabled / Videosize 640x360 / Allow frame skipping is enabled

3.) I would be glad to be abled to put an overlay over screen so a little log apears on the right upper corner. That would be an great additional feature.

Maarten Baert

Administrator

Comment #6: Fri, 18 Oct 2013, 19:03 (GMT+1, DST)

Quote


Quote: Glog78

First of all thanx for the livestreaming option. It's the only way i get a synced audio video stream to twitch.
Still a few questions are left:
1) You mentione VBV Options above, can you describe the usage a little more ?

They aren't available yet, I intend to add them when I have time.

Quote: Glog78

2) Can you please somehow implement that there is at least a max-bitrate which never get crossed -> i only have 768kb upload and even with the following custom options

preset=fast,tune=zerolatency,vbv-maxrate=600,qmax=51,qmin=10,vbv-bufsize=600

i get so high spikes that the stream stops working for viewers. Additional Information -> Scale Video is enabled / Videosize 640x360 / Allow frame skipping is enabled

This is what VBV options would do.

Quote: Glog78

3.) I would be glad to be abled to put an overlay over screen so a little log apears on the right upper corner. That would be an great additional feature.

The easiest way to do that is to just put a window there and mark it as 'always stay on top' in your window manager (usually by right-clicking the title bar). It is really hard to add something like this to SSR, and I still have a long to-do list at the moment (the feature request is already here).

Glog78

Comment #7: Sat, 19 Oct 2013, 20:16 (GMT+1, DST)

Quote


I made a small patch -> http://pastie.org/8414793.

This introduces vbv-maxrate and vbv-bufsize. That way im able to at least cap the maxbitrate somehow.

Maybe that makes your work a little easier Maarten.

Maarten Baert

Administrator

Comment #8: Sat, 19 Oct 2013, 23:39 (GMT+1, DST)

Quote


@Glog78: Thanks. Your patch was corrupted though, I had to add it manually. I think that website replaced the tabs with spaces.

I've now added the options 'minrate', 'maxrate' and 'bufsize'. Those are the same names ffmpeg/avconv uses.

Last modified: Sat, 19 Oct 2013, 23:39 (GMT+1, DST)

Tatokis

Comment #9: Sun, 20 Oct 2013, 0:33 (GMT+1, DST)

Quote


I am trying to make this awesome program work with twitch.tv but I can't for some reason.
I have pasted the rtmp link with the API key, I have set FLV as the container, set the encoder to libx264 (with ffmpeg) and audio encoder AAC at 64kbps but each time I press start recording, I get:

Quote

RTMP_ReadPacket, failed to read RTMP packet header
[Muxer::Init] Error: Can't open output file!
[PageRecord::RecordStart] Error: Something went wrong during initialization.

Recording works fine, it is just that I can't stream to twitch.
Thanks in advance
--
EDIT: Nevermind, strangely enough it works now. I didn't change anything!
Maybe it was a twitch issue.
Anyway, keep up the good work!

Last modified: Sun, 20 Oct 2013, 0:36 (GMT+1, DST)

Glog78

Comment #10: Sun, 20 Oct 2013, 11:54 (GMT+1, DST)

Quote


Hi Marten,

i think rc_max_bitrate and rc_min_bitrate doesn't work as we expected (eg: ffmpeg), cause of this needed timestamp conversion.

http://libav-users.943685.n4.nabble.com/Setting-libx264-bitrate-via-API-td4655453.html

i'm just not sure where they get the ost->time() from and how to map it to simple screen recorder.

Maarten Baert

Administrator

Comment #11: Sun, 20 Oct 2013, 19:21 (GMT+1, DST)

Quote


Quote: Glog78

Hi Marten,

i think rc_max_bitrate and rc_min_bitrate doesn't work as we expected (eg: ffmpeg), cause of this needed timestamp conversion.

http://libav-users.943685.n4.nabble.com/Setting-libx264-bitrate-via-API-td4655453.html

i'm just not sure where they get the ost->time() from and how to map it to simple screen recorder.

I'm not 100% sure, but it sounds like they were just doing their timestamps wrong. SSR uses the encoder time base to encode the frames and then converts the timestamps to the stream time base when muxing. This is what the ffmpeg/libav example code does too.

I have done some streaming with maxrate and bufsize (to twitch.tv) and it did work, so I don't think there's an issue.

Glog78

Comment #12: Mon, 21 Oct 2013, 6:49 (GMT+1, DST)

Quote


If you use ffmpeg with -maxrate 500k -bufsize--500k it never goes over the 500kbit/s. It instead adapts the crf / qp to fit the stream. When i do the same with the actual solution it spikes up to 800kbit/s end even 900kbit/s on simple screen recorder side.

That means instead of setting my bitrate closer to the maxium of my line i need to set it much more less. I also tried to use rc_vbv_max_bitrate and the tolerance but none of them had an effect.

Off course it might be a bugged ffmpeg on arch linux but i can't imagine that cause again ffmpeg itself does do fine if you use maxrate.

The entry on the libav forums was the only i have found on this isses ... so it's just a possibility.

Maarten Baert

Administrator

Comment #13: Tue, 22 Oct 2013, 0:26 (GMT+1, DST)

Quote


Quote: Glog78

If you use ffmpeg with -maxrate 500k -bufsize--500k it never goes over the 500kbit/s. It instead adapts the crf / qp to fit the stream. When i do the same with the actual solution it spikes up to 800kbit/s end even 900kbit/s on simple screen recorder side.

That means instead of setting my bitrate closer to the maxium of my line i need to set it much more less. I also tried to use rc_vbv_max_bitrate and the tolerance but none of them had an effect.

Off course it might be a bugged ffmpeg on arch linux but i can't imagine that cause again ffmpeg itself does do fine if you use maxrate.

The entry on the libav forums was the only i have found on this isses ... so it's just a possibility.

This may be related to the way the bitrate is calculated. I calculate the bitrate manually simply by checking the number of bytes written and the timestamps of the packets. This is often inaccurate but I couldn't find a better solution. On average it is still correct though.

But even with ffmpeg, it is perfectly possible that the bitrate will occasionally go above 'maxrate' if it has stayed below 'maxrate' for some time. This is normal. The 'bufsize' indicates how much variation is allowed (in practical terms, it indicates how much memory the receiver will need to buffer the stream assuming a perfectly constant download speed equal to 'maxrate').

So in other words, as long as the download speed is at least 'maxrate', and the receiver has a buffer of at least 'bufsize', the stream will play fine even when the bitrate peaks above 'maxrate' occasionally. If you set 'bufsize' equal to 'maxrate', this corresponds to a one-second buffer. Most players will buffer the stream for a few seconds before they start playing, so this is fine.

Last modified: Tue, 22 Oct 2013, 0:27 (GMT+1, DST)

Ubuntuaddicted

Comment #14: Thu, 21 Nov 2013, 10:43 (GMT+1, DST)

Quote


Quote: Maarten Baert

@Glog78: Thanks. Your patch was corrupted though, I had to add it manually. I think that website replaced the tabs with spaces.

I've now added the options 'minrate', 'maxrate' and 'bufsize'. Those are the same names ffmpeg/avconv uses.

when you say you added them I am not sure I see them in the program. i've set my codec to xlib264 but the only options that appear are bit rate (in kb/ps) and custom options.

Also, i was curious if you can incorporate UVC webcam captures at the same time. There's already a script here: http://pastebin.com/AZaXXUfj that has both screen capture and webcam capture. Whats nice about the script also is that if you want to record a window versus your whole desktop, you merely click the window you want to record instead of having to find out the window info using some command line tool. Since I am asking about features, can you somehow adapt the input to be able to record other things besides your desktop, for example a webcam or a device node? I have an HD-PVR which I capture by just using the terminal and issuing cat /dev/video1 > video.ts and it captures my xbox 360 into a file using h264 and aac audio in a mp4 container, is there some way your program could capture HD-PVR over usb and re-encode it for optimal streaming experience?

Awesome software by the way

Last modified: Thu, 21 Nov 2013, 12:25 (GMT+1, DST)

Maarten Baert

Administrator

Comment #15: Fri, 22 Nov 2013, 21:35 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

when you say you added them I am not sure I see them in the program. i've set my codec to xlib264 but the only options that appear are bit rate (in kb/ps) and custom options.

Exactly, those are custom options. I still have to document them though :).

Quote: Ubuntuaddicted

Whats nice about the script also is that if you want to record a window versus your whole desktop, you merely click the window you want to record instead of having to find out the window info using some command line tool.

What do you mean? That's what SSR does, right?

Quote: Ubuntuaddicted

Since I am asking about features, can you somehow adapt the input to be able to record other things besides your desktop, for example a webcam or a device node? I have an HD-PVR which I capture by just using the terminal and issuing cat /dev/video1 > video.ts and it captures my xbox 360 into a file using h264 and aac audio in a mp4 container, is there some way your program could capture HD-PVR over usb and re-encode it for optimal streaming experience?

Awesome software by the way

It's on the to-do list, but for now my advice is to put your webcam in a window and make that 'always on top':
https://github.com/MaartenBaert/ssr/issues/64
It's a bit silly, but you get feedback (you see what others will see) and it's simple :).

Ubuntuaddicted

Comment #16: Fri, 22 Nov 2013, 22:52 (GMT+1, DST)

Quote


Quote: Maarten Baert

Exactly, those are custom options. I still have to document them though :).

anyone else curious which options i used within the libx264 options box

preset=fast,tune=zerolatency,minrate=3500k,maxrate=3500k,bufsize=3500k
Quote: Maarten Baert

What do you mean? That's what SSR does, right?

not that I am aware, i have to use xwininfo to find out the x & y coordinates of the window I want to record if it's not fullscreen. I was sort of asking if you could incorporate selecting which window you wanted to record versus having to know the location manually.

Quote: Maarten Baert

It's on the to-do list, but for now my advice is to put your webcam in a window and make that 'always on top':
https://github.com/MaartenBaert/ssr/issues/64
It's a bit silly, but you get feedback (you see what others will see) and it's simple :).

i can do that for the webcam BUT is there future plans to be able to record from say, /dev/video0? that's what my HD-PVR is which capture my xbox 360 into a .ts file using x264 and aac audio. The way I have to capture it now to my desktop is using

cat /dev/video0 > video.ts

but i don't see a way to use ssr in order to stream my xbox 360 gameplay to twitch OR even use it to start and stop recording versus me having to keep a terminal open and using ctrl+c when I am done capturing the scene from my xbox 360. Do you understand what I am asking for?

Maarten Baert

Administrator

Comment #17: Sat, 23 Nov 2013, 1:07 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

anyone else curious which options i used within the libx264 options box

preset=fast,tune=zerolatency,minrate=3500k,maxrate=3500k,bufsize=3500k

I just wrote documentation: link.
You probably shouldn't set 'minrate', it doesn't really make sense and it can make things worse.

Quote: Ubuntuaddicted

not that I am aware, i have to use xwininfo to find out the x & y coordinates of the window I want to record if it's not fullscreen. I was sort of asking if you could incorporate selecting which window you wanted to record versus having to know the location manually.

So you really didn't see the 'select window' button, right above the textboxes where you have to enter the size? ;)

Quote: Ubuntuaddicted

i can do that for the webcam BUT is there future plans to be able to record from say, /dev/video0? that's what my HD-PVR is which capture my xbox 360 into a .ts file using x264 and aac audio. The way I have to capture it now to my desktop is using

cat /dev/video0 > video.ts

but i don't see a way to use ssr in order to stream my xbox 360 gameplay to twitch OR even use it to start and stop recording versus me having to keep a terminal open and using ctrl+c when I am done capturing the scene from my xbox 360. Do you understand what I am asking for?

I don't completely understand how /dev/video* works, I thought it produced raw video data that you could only read with the video4linux2 library. But apparently it generates a fully encoded transport stream in your case?

If you want to stream this directly to twitch without re-encoding it, then SSR is not what you should use, it will always re-encode which is a waste of CPU time, and also try to synchronize audio which would not make sense if the original file already has audio that's properly synced.

You can stream it directly to Twitch with ffmpeg though, assuming everything is correctly encoded (and assuming the audio is in sync). Something like this should work:

avconv -f mpegts -i /dev/video1 -c:v copy -c:a copy -f flv rtmp://yourtwitchserverofchoice/app/live_****

That's assuming it is indeed H.264 and AAC (I doubt it's x264 since it sounds like that device uses a hardware encoder).

And in case you *do* want to re-encode (you may get better quality and you can set the bitrate), this is still more efficient:

avconv -f mpegts -i /dev/video1 -c:v libx264 -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a copy -f flv rtmp://yourtwitchserverofchoice/app/live_****

I can't test this at all because I don't have the device, and my /dev/video0 (webcam) works completely differently, so I may have missed something.

Now if you are actually trying to combine audio from the computer with video from the device and keep those in sync, that's a completely different story. This is actually very hard because the device is already encoding the video, so it will have a large delay. You would have to do some really strange things like trying to measure the delay somehow (assuming it is constant, and it probably isn't) and tell SSR about this (which is not supported at the moment, but it could be added) so it can delay the audio by the same amount (theoretically possible because audio is pretty small). But then SSR still needs a special 'file' input where it uses ffmpeg to load an encoded video file and decode it. It's all possible but it would take a lot of time to add, and I don't even think you would like the result, because the audio would probably still be quite a bit out of sync.

Last modified: Sat, 23 Nov 2013, 1:08 (GMT+1, DST)

Ubuntuaddicted

Comment #18: Sat, 23 Nov 2013, 9:18 (GMT+1, DST)

Quote


Quote: Maarten Baert

I just wrote documentation: link.
You probably shouldn't set 'minrate', it doesn't really make sense and it can make things worse.

i saw the documentation, THANK YOU! From what I read if I want to achieve as close to a CBR as I can I would set the minrate and maxrate the same. Does minrate not work in achieving such that the bitrate does not go below that setting? Twitch TV suggests using a CBR versus a VBR but I know ffmpeg or avconv don't really have a CBR setting.
Such awesome support, you don't know how grateful I am. Is there a paypal account I could donate some money to for your hard work with this great GUI? I know your original intention of the app was for screen casting but this is turning out to be the ONLY GUI solution to linux desktop live streaming that I have found and I googled/read stuff for hours

Quote: Maarten Baert

So you really didn't see the 'select window' button, right above the textboxes where you have to enter the size? ;)

no i didn't see it. i saw the boxes for entering the x and y manually so I was like a horse with blinders on, only saw 1 thing. LOL it's right there right in front of my face. sorry about that.

Quote: Maarten Baert

I don't completely understand how /dev/video* works, I thought it produced raw video data that you could only read with the video4linux2 library. But apparently it generates a fully encoded transport stream in your case?

not just in my case, in every ones case because it outputs a slightly modified multiplexed MPEG-2 Transport Stream. the device has a built in encoder in it. Here's all the info http://www.mythtv.org/wiki/Hauppauge_HD-PVR The hdpvr module was added to the mainline kernel at version ~2.6.29.1

Quote: Maarten Baert

If you want to stream this directly to twitch without re-encoding it, then SSR is not what you should use, it will always re-encode which is a waste of CPU time, and also try to synchronize audio which would not make sense if the original file already has audio that's properly synced.

You can stream it directly to Twitch with ffmpeg though, assuming everything is correctly encoded (and assuming the audio is in sync). Something like this should work:

avconv -f mpegts -i /dev/video1 -c:v copy -c:a copy -f flv rtmp://yourtwitchserverofchoice/app/live_****

That's assuming it is indeed H.264 and AAC (I doubt it's x264 since it sounds like that device uses a hardware encoder).

And in case you *do* want to re-encode (you may get better quality and you can set the bitrate), this is still more efficient:

avconv -f mpegts -i /dev/video1 -c:v libx264 -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a copy -f flv rtmp://yourtwitchserverofchoice/app/live_****

I can't test this at all because I don't have the device, and my /dev/video0 (webcam) works completely differently, so I may have missed something.

Now if you are actually trying to combine audio from the computer with video from the device and keep those in sync, that's a completely different story. This is actually very hard because the device is already encoding the video, so it will have a large delay. You would have to do some really strange things like trying to measure the delay somehow (assuming it is constant, and it probably isn't) and tell SSR about this (which is not supported at the moment, but it could be added) so it can delay the audio by the same amount (theoretically possible because audio is pretty small). But then SSR still needs a special 'file' input where it uses ffmpeg to load an encoded video file and decode it. It's all possible but it would take a lot of time to add, and I don't even think you would like the result, because the audio would probably still be quite a bit out of sync

I tried both the commands you provided, the first attempt was re-encoding it, here's the terminal output: http://pastebin.com/iUK8CjeC
and the hd-pvr's recording light goes out (stops recording/encoding) after less than 1 minute.
and then I tried just copying the streams and that actually did nothing. the recording light on the hd-pvr turned on but my terminal never went past the following line:

avconv version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:08:00 with gcc 4.6.3

the recording light did turn on for about 10 seconds but then it shuts off.

my goal would be to use the hdpvr device to capture the xbox 360 (or any device that outputs to component or composite) and combine that with my microphone from my computer into 1 stream and have that streamed to twtich. People are doing that now using various windows based software like Xsplit, OBS (Open Broadcast Software) or the software that comes with an Elgato game capture hd or even the newer HD-PVR2 gaming edition. It allows you to record high definition video (even up to 1080p if you have a computer strong enough and enough bandwidth) from a non-hdcp device, combine your mic into the stream and then stream that to a live streaming site like ustream, twitch, own3d etc etc.

I now see your point about mixing in the mic, it would be very difficult but many developers have figured it out for windows based machines. I believe OBS is being re-written to be cross-platform and will use the new wxwidgets for its GUI so it's possible you could look into that as I am sure they could use more developers. OBS was the first F.O.S.S. written to livestream hd content that I am aware of. There are many commercially available tools like wirecast and the like.

I really appreciate your hard work and this great tool you have made. I know I am asking a lot. If anything, just consider what I am asking because there is certainly a need for it but I am not aware of how large that need is since most games people want to watch on livestreaming sites are PC games written in DirectX but hopefully SteamOS will make 2014 the year of linux gaming.

Last modified: Sat, 23 Nov 2013, 9:20 (GMT+1, DST)

Maarten Baert

Administrator

Comment #19: Sat, 23 Nov 2013, 18:45 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

i saw the documentation, THANK YOU! From what I read if I want to achieve as close to a CBR as I can I would set the minrate and maxrate the same. Does minrate not work in achieving such that the bitrate does not go below that setting? Twitch TV suggests using a CBR versus a VBR but I know ffmpeg or avconv don't really have a CBR setting.

The bitrate modes supported by ffmpeg also depend on the codec that you are using. But for x264, it does definitely support CBR. However, even in these modes you will never get a perfectly constant bitrate, simply because doing so would be a very bad idea. Video codecs use different types of frames, some frames are keyframes and those are encoded in pretty much the same way as a JPEG image, but the other frames are encoded by describing the *difference* between the new frame and existing frames (most commonly the previous frame) because this takes less space. If you look at the size in bytes of each frame, you will see that the keyframes are huge compared to the normal frames. If you want a perfectly constant bitrate, you would be forcing the encoder to make all frames exactly the same size, even keyframes, and that will ruin the video quality: the keyframes won't have enough bytes to store the frame with a decent quality, and the other frames will have more bytes than they need. It's just a bad idea. That's why the 'bufsize' option exists, it gives the encoder some freedom to make keyframes larger and other frames smaller.

If the encoder wants to use less than the bit rate that you've set, there's probably a reason for that, and you shouldn't try to stop it. You're just wasting bandwidth. You can assume that the creators of the encoder know what they are doing :).

Quote: Ubuntuaddicted

Such awesome support, you don't know how grateful I am. Is there a paypal account I could donate some money to for your hard work with this great GUI? I know your original intention of the app was for screen casting but this is turning out to be the ONLY GUI solution to linux desktop live streaming that I have found and I googled/read stuff for hours

This is just a hobby, it doesn't cost me anything so I don't accept donations :).

Quote: Ubuntuaddicted

not just in my case, in every ones case because it outputs a slightly modified multiplexed MPEG-2 Transport Stream. the device has a built in encoder in it. Here's all the info http://www.mythtv.org/wiki/Hauppauge_HD-PVR The hdpvr module was added to the mainline kernel at version ~2.6.29.1

What I mean is that on my computer, /dev/video0 is my webcam, and it produces raw frames. I tried running cat /dev/video0 > file.ts but it doesn't work at all (which is what I expected). That's important to know, because it means I have to provide two different ways to read video stream - one that uses video4linux2 and one that reads and decodes the TS stream with ffmpeg.

Quote: Ubuntuaddicted

I tried both the commands you provided, the first attempt was re-encoding it, here's the terminal output: http://pastebin.com/iUK8CjeC
and the hd-pvr's recording light goes out (stops recording/encoding) after less than 1 minute.
and then I tried just copying the streams and that actually did nothing. the recording light on the hd-pvr turned on but my terminal never went past the following line:

avconv version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:08:00 with gcc 4.6.3

the recording light did turn on for about 10 seconds but then it shuts off.

It looks like avconv is trying to analyze the input file, but that doesn't work for a device like this since it's not a real file. Let's try to fix this one step at a time, so for now just try to create a valid flv file instead of streaming to Twitch. When that works, hopefully streaming will work too. For simplicity, let's just re-encode both streams for now. Try this one:

cat /dev/video0 | avconv -f mpegts -i - -c:v libx264 -preset veryfast -tune zerolatency -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a libvo_aacenc -b:a 128k -y testfile.flv

Last time I forgot to add the preset, so it's possible your CPU was simply too slow and couldn't keep up with the video (after all it has to decode it first and then re-encode it, not an easy task). I've also changed the way avconv reads the input: instead of opening the file directly, it's now piped in, which will hopefully fix the analysis issue (I think avconv knows it cannot seek in a pipe). Let this run for a minute and then kill it (Ctrl+C, Q will not work). Then try to play 'testfile.flv'. Does that work?

Of course this won't give you audio from your computer yet, but it's a first step and I need to know whether this is possible before I try to add a 'video file' input to SSR.

Quote: Ubuntuaddicted

my goal would be to use the hdpvr device to capture the xbox 360 (or any device that outputs to component or composite) and combine that with my microphone from my computer into 1 stream and have that streamed to twtich. People are doing that now using various windows based software like Xsplit, OBS (Open Broadcast Software) or the software that comes with an Elgato game capture hd or even the newer HD-PVR2 gaming edition. It allows you to record high definition video (even up to 1080p if you have a computer strong enough and enough bandwidth) from a non-hdcp device, combine your mic into the stream and then stream that to a live streaming site like ustream, twitch, own3d etc etc.

I now see your point about mixing in the mic, it would be very difficult but many developers have figured it out for windows based machines. I believe OBS is being re-written to be cross-platform and will use the new wxwidgets for its GUI so it's possible you could look into that as I am sure they could use more developers. OBS was the first F.O.S.S. written to livestream hd content that I am aware of. There are many commercially available tools like wirecast and the like.

I still think synchronizing audio will be a mess. But if you say it's possible with those tools, then it's probably not as bad as I expected. Maybe the hardware encoder in the device encodes frames in such a way that they only depend on the previous frame (like the 'zerolatency' mode for x264), in that case the latency may actually be only one frame, which is hardly noticeable and also easy to compensate if needed.

Could you record a short video (~20 seconds) using cat /dev/video0 > test.ts and send me that file? I think I should be able to do some testing by essentially emulating the HD-PVR if I have that file. Don't put it on youtube though, just upload the unmodified ts file somewhere. I need the original file the way it was encoded by the device, not a modified version.

Ubuntuaddicted

Comment #20: Sun, 24 Nov 2013, 18:10 (GMT+1, DST)

Quote


Quote: Maarten Baert

The bitrate modes supported by ffmpeg also depend on the codec that you are using. But for x264, it does definitely support CBR. However, even in these modes you will never get a perfectly constant bitrate, simply because doing so would be a very bad idea. Video codecs use different types of frames, some frames are keyframes and those are encoded in pretty much the same way as a JPEG image, but the other frames are encoded by describing the *difference* between the new frame and existing frames (most commonly the previous frame) because this takes less space. If you look at the size in bytes of each frame, you will see that the keyframes are huge compared to the normal frames. If you want a perfectly constant bitrate, you would be forcing the encoder to make all frames exactly the same size, even keyframes, and that will ruin the video quality: the keyframes won't have enough bytes to store the frame with a decent quality, and the other frames will have more bytes than they need. It's just a bad idea. That's why the 'bufsize' option exists, it gives the encoder some freedom to make keyframes larger and other frames smaller.

If the encoder wants to use less than the bit rate that you've set, there's probably a reason for that, and you shouldn't try to stop it. You're just wasting bandwidth. You can assume that the creators of the encoder know what they are doing :).

that makes sense. thanks for explaining that.

Quote: Maarten Baert

What I mean is that on my computer, /dev/video0 is my webcam, and it produces raw frames. I tried running cat /dev/video0 > file.ts but it doesn't work at all (which is what I expected). That's important to know, because it means I have to provide two different ways to read video stream - one that uses video4linux2 and one that reads and decodes the TS stream with ffmpeg.

oh, i see what you mean now. i've tried other GUI's that use v4l2 and they don't work. i've even tried to use kdenlive's built in ffmpeg recording feature both with v4l2 box checked and with it unchecked and had selected /dev/video1 (i have a webcam as well so my hd-pvr is video device node 1) as the input but it just records a white screen but there is audio believe it or not.

Quote: Maarten Baert

It looks like avconv is trying to analyze the input file, but that doesn't work for a device like this since it's not a real file. Let's try to fix this one step at a time, so for now just try to create a valid flv file instead of streaming to Twitch. When that works, hopefully streaming will work too. For simplicity, let's just re-encode both streams for now. Try this one:

cat /dev/video0 | avconv -f mpegts -i - -c:v libx264 -preset veryfast -tune zerolatency -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a libvo_aacenc -b:a 128k -y testfile.flv

Last time I forgot to add the preset, so it's possible your CPU was simply too slow and couldn't keep up with the video (after all it has to decode it first and then re-encode it, not an easy task). I've also changed the way avconv reads the input: instead of opening the file directly, it's now piped in, which will hopefully fix the analysis issue (I think avconv knows it cannot seek in a pipe). Let this run for a minute and then kill it (Ctrl+C, Q will not work). Then try to play 'testfile.flv'. Does that work?

as I mentioned earlier, i switched the command to capture from /dev/video1 since that's where my hdpvr is. the blue light turns on the hd-pvr after all those errors are finished but sadly it stops after only a few seconds and in fact the avconv command appears to freeze. Here's whats in the terminal when it freezes

frame=  338 fps= 95 q=14.0 size=    2555kB time=5.69 bitrate=3679.1kbits/s dup=0 drop=2

Here's the whole output from running the command.
http://pastebin.com/HHvXBUDr
How come you have to re-encode it?

Quote: Maarten Baert

I still think synchronizing audio will be a mess. But if you say it's possible with those tools, then it's probably not as bad as I expected. Maybe the hardware encoder in the device encodes frames in such a way that they only depend on the previous frame (like the 'zerolatency' mode for x264), in that case the latency may actually be only one frame, which is hardly noticeable and also easy to compensate if needed.

Could you record a short video (~20 seconds) using cat /dev/video0 > test.ts and send me that file? I think I should be able to do some testing by essentially emulating the HD-PVR if I have that file. Don't put it on youtube though, just upload the unmodified ts file somewhere. I need the original file the way it was encoded by the device, not a modified version.

here's a video file straight from using the cat command. it's hosted at my dropbox in the public folder, you should be able to access it. it's around 28MB.
https://www.dropbox.com/sh/b1dnimy2oa1n3le/LcGG3tM8bp
Let me know if you can access it. I look forward to working more with you on this so we can make your tool even better. Is there an email that I can get from you possibly so then we could exchange skype info in case you want to do any testing in real time?

Maarten Baert

Administrator

Comment #21: Mon, 25 Nov 2013, 2:37 (GMT+1, DST)

Quote


Re-encoding is actually easier than trying to keep the original encoded stream, because even though different formats use the same codecs, they sometimes store it in a different format. It's often still possible to avoid re-encoding, but it's harder. So let's leave that for later.

For live streaming, you want to re-encode at least the video because what you get from the device is just not encoded good enough. Hardware encoders will usually not give you the same quality vs. file size as x264 :). Also, the bit rate of the original file is a bit too high for streaming anyway (~6893kbps).

The weird thing is that your test file works just fine for me. So maybe it's because I'm using the latest ffmpeg and you're using an outdated version of avconv (Ubuntu is behind a lot, they haven't updated their avconv/libav since 12.04). I used this command:

cat ubuntuaddicted-hd-pvr-test.ts | ffmpeg -f mpegts -i - -c:v libx264 -preset veryfast -tune zerolatency -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a aac -strict -2 -b:a 128k -y testfile.flv

It's a bit different because I'm using ffmpeg, it doesn't have the same AAC codec. Is there a way for you to get the latest ffmpeg and try that instead?

Ubuntuaddicted

Comment #22: Mon, 25 Nov 2013, 5:23 (GMT+1, DST)

Quote


Quote: Maarten Baert

Re-encoding is actually easier than trying to keep the original encoded stream, because even though different formats use the same codecs, they sometimes store it in a different format. It's often still possible to avoid re-encoding, but it's harder. So let's leave that for later.

For live streaming, you want to re-encode at least the video because what you get from the device is just not encoded good enough. Hardware encoders will usually not give you the same quality vs. file size as x264 :). Also, the bit rate of the original file is a bit too high for streaming anyway (~6893kbps).

The weird thing is that your test file works just fine for me. So maybe it's because I'm using the latest ffmpeg and you're using an outdated version of avconv (Ubuntu is behind a lot, they haven't updated their avconv/libav since 12.04). I used this command:

cat ubuntuaddicted-hd-pvr-test.ts | ffmpeg -f mpegts -i - -c:v libx264 -preset veryfast -tune zerolatency -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a aac -strict -2 -b:a 128k -y testfile.flv

It's a bit different because I'm using ffmpeg, it doesn't have the same AAC codec. Is there a way for you to get the latest ffmpeg and try that instead?

the test file may work fine for you but remember, the hd-pvr is shutting itself off after only a few seconds, whether it's because the command freezes or for some other reason I am not sure. If the little blue light shuts off on the hd-pvr that means my computer is no longer recording from the hd-pvr. I am certain there is enough file space for the video file so that's not the issue. I know the hd-pvr is working in general because I can capture from it like I always do using cat /dev/video1 > video.ts and leave it on for 15+ minutes and the blue light is still on and it's still recording in the terminal. SO it's something about that command, not sure?

I am running Xubuntu 12.04.3 because I like to stay with the LTS releases. I am sure I could install the latest ffmpeg BUT i have other software that requires it and certain libraries to function properly like kdenlive. I need kdenlive daily as I make youtube videos. I'd hate to try and compile the latest ffmpeg and then my kdenlive not work, I would not be a happy camper. Maybe I can install Xubuntu 13.10 within a Virtual Box, does Xubuntu 13.10 have a recent ffmpeg or is it using avconv still? According to aptitude the installed version of ffmpeg is 4:0.8.9-0ubuntu0.12.04.1

Maarten Baert

Administrator

Comment #23: Mon, 25 Nov 2013, 11:22 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

the test file may work fine for you but remember, the hd-pvr is shutting itself off after only a few seconds, whether it's because the command freezes or for some other reason I am not sure. If the little blue light shuts off on the hd-pvr that means my computer is no longer recording from the hd-pvr. I am certain there is enough file space for the video file so that's not the issue. I know the hd-pvr is working in general because I can capture from it like I always do using cat /dev/video1 > video.ts and leave it on for 15+ minutes and the blue light is still on and it's still recording in the terminal. SO it's something about that command, not sure?

That's why in my command, the first command is just 'cat'. It should just read the file and do nothing else, so if cat /dev/video0 > test.ts works, then cat /dev/video0 | ... should work too (assuming the encoders are fast enough to keep up, that's why I picked the 'veryfast' preset).

Quote: Ubuntuaddicted

I am running Xubuntu 12.04.3 because I like to stay with the LTS releases. I am sure I could install the latest ffmpeg BUT i have other software that requires it and certain libraries to function properly like kdenlive. I need kdenlive daily as I make youtube videos. I'd hate to try and compile the latest ffmpeg and then my kdenlive not work, I would not be a happy camper. Maybe I can install Xubuntu 13.10 within a Virtual Box, does Xubuntu 13.10 have a recent ffmpeg or is it using avconv still? According to aptitude the installed version of ffmpeg is 4:0.8.9-0ubuntu0.12.04.1

Ubuntu hasn't updated libav (that's an ffmpeg fork, which Ubuntu uses) since 12.04, so switching to 13.10 is not going to help you. And if you install something in a VM, I'm not sure whether you will even be able to read /dev/video*, you would have to redirect it somehow. And even compiling the latest ffmpeg may not be enough since all the codecs you have installed are also mostly outdated, but it's a good start.

By the way, ffmpeg/libav version number are really weird, I can't tell what version that is unless you run avconv -version. That will print the version numbers for all components.

Luckily linux allows you to install multiple versions of the same library at the same time. I use Arch Linux and I actually have two versions installed: libavcodec 53 (for Audacity) and 55 (for everything else). So I don't think your system will break if you compile the latest ffmpeg from source, especially if you put it in /usr/local/ (this is the default if you compile from source).

Ubuntuaddicted

Comment #24: Mon, 25 Nov 2013, 13:09 (GMT+1, DST)

Quote


Quote: Maarten Baert

That's why in my command, the first command is just 'cat'. It should just read the file and do nothing else, so if cat /dev/video0 > test.ts works, then cat /dev/video0 | ... should work too (assuming the encoders are fast enough to keep up, that's why I picked the 'veryfast' preset).

i understand it "should" work but it's not. as I have said the hd-pvr stops capturing after only about 15 seconds. I don't think the pipe is working. To entertain myself I attempted 2 different commands, i 1 terminal window I ran

cat /dev/video1 > video.ts

which is working fine, the blue recording light is on and stays on
and in another window I ran

ffmpeg -f mpegts -i video.ts -c:v libx264 -preset veryfast -tune zerolatency -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a aac -strict -2 -b:a 128k -y testfile.flv

but sadly it appears as though the avconv switches you used return the following.
Unrecognized option 'c:v'
Failed to set value 'libx264' for option 'c:v'

Quote: Maarten Baert

Ubuntu hasn't updated libav (that's an ffmpeg fork, which Ubuntu uses) since 12.04, so switching to 13.10 is not going to help you. And if you install something in a VM, I'm not sure whether you will even be able to read /dev/video*, you would have to redirect it somehow. And even compiling the latest ffmpeg may not be enough since all the codecs you have installed are also mostly outdated, but it's a good start.

By the way, ffmpeg/libav version number are really weird, I can't tell what version that is unless you run avconv -version. That will print the version numbers for all components.

Luckily linux allows you to install multiple versions of the same library at the same time. I use Arch Linux and I actually have two versions installed: libavcodec 53 (for Audacity) and 55 (for everything else). So I don't think your system will break if you compile the latest ffmpeg from source, especially if you put it in /usr/local/ (this is the default if you compile from source).

you say compiling ffmpeg may not be enough because my codec's are outdated as well but yet you told me to install the latest ffmpeg. I don't know what you want me to try by reading your statements.
the version of avconv is

avconv version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:08:00 with gcc 4.6.3
avconv 0.8.9-4:0.8.9-0ubuntu0.12.04.1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 0
libpostproc  52.  0. 0 / 52.  0. 0

WOW, that looks pretty recent to me, it was built on November 9th 2013.

Last modified: Mon, 25 Nov 2013, 13:16 (GMT+1, DST)

Maarten Baert

Administrator

Comment #25: Mon, 25 Nov 2013, 13:17 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

i understand it "should" work but it's not. as I have said the hd-pvr stops capturing after only about 15 seconds.

And AFAIK that can only happen if the next process in the pipeline (avconv) stops reading, otherwise 'cat' would continue to run. And you're still getting these error messages, so there's still something strange happening.

Quote: Ubuntuaddicted

you say compiling ffmpeg may not be enough because my codec's are outdated as well but yet you told me to install the latest ffmpeg. I don't know what you want me to try by reading your statements.

What I mean is that I'm not sure whether it will fix it, but I think it's worth a try. If you don't try it, you will never know :).

Quote: Ubuntuaddicted

the version of avconv is

avconv version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:08:00 with gcc 4.6.3
avconv 0.8.9-4:0.8.9-0ubuntu0.12.04.1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 0
libpostproc  52.  0. 0 / 52.  0. 0

WOW, that looks pretty recent to me, it was built on November 9th 2013.

Built this month from source code that's now almost two years old ;). My version:

ffmpeg version 2.1.1
built on Nov 20 2013 15:42:03 with gcc 4.8.2 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
libavutil      52. 48.101 / 52. 48.101
libavcodec     55. 39.101 / 55. 39.101
libavformat    55. 19.104 / 55. 19.104
libavdevice    55.  5.100 / 55.  5.100
libavfilter     3. 90.100 /  3. 90.100
libavresample   1.  1.  0 /  1.  1.  0
libswscale      2.  5.101 /  2.  5.101
libswresample   0. 17.104 /  0. 17.104
libpostproc    52.  3.100 / 52.  3.100

So your libavcodec, the most important component, is now two major versions behind. That could explain why you're getting errors that I don't get.

Ubuntuaddicted

Comment #26: Mon, 25 Nov 2013, 20:01 (GMT+1, DST)

Quote


Quote: Maarten Baert

So your libavcodec, the most important component, is now two major versions behind. That could explain why you're getting errors that I don't get.

What errors? About -c:v not existing? I looked into that and in the libav documentation it listed that as applicable so not sure why it complained. Oh wait, cause the command was using ffmpeg, I bet if I change it to avconv it'll work.

If I followed this guide would this work to help you in testing the HD-PVR? https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide

Shneekeythelost

Comment #27: Mon, 25 Nov 2013, 21:55 (GMT+1, DST)

Quote


Came up with a very interesting and annoying error while trying to stream to Twitch.tv:

Quote

[FastScaler::Scale] Warning: Memory is not properly aligned for SSE, using fallback converter instead. This is not a problem but performance will be worse.

I don't know precisely what this means, but I took a lot of your suggestions, I'm using the following settings:

Container: flv
Video: libx264
Bitrate: 3500
Custom Options: preset=fast,tune=zerolatency,maxrate=3500,bufsize=3500

Audio: AAC 128 bit

Basically, as long as the screen is not moving, I get 30 FPS, when I start moving the cursor around, it drops down as low as 2-3 FPS.

I'm running an 8 core AM3+ 3.5 GHz Processor with 8 GB dual-channel DDR3 SDRAM, so I don't think I'm using up my memory or processing speed by any means.

When I set it up and use Preview, it doesn't have the problem, the preview follows along at 30 FPS perfectly well. It's only when I actually start streaming that it goes into the toilet.

Maarten Baert

Administrator

Comment #28: Tue, 26 Nov 2013, 0:20 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

What errors? About -c:v not existing? I looked into that and in the libav documentation it listed that as applicable so not sure why it complained. Oh wait, cause the command was using ffmpeg, I bet if I change it to avconv it'll work.

No, I mean the long list of error messages at the start (the h264 ones). That should not happen.

Quote: Ubuntuaddicted

If I followed this guide would this work to help you in testing the HD-PVR? https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide

I think so. But as I said last time, I can't be sure because I don't have your device.

Quote: Shneekeythelost

Came up with a very interesting and annoying error while trying to stream to Twitch.tv:

Quote

[FastScaler::Scale] Warning: Memory is not properly aligned for SSE, using fallback converter instead. This is not a problem but performance will be worse.

I don't know precisely what this means, but I took a lot of your suggestions, I'm using the following settings:

It's not an error but a warning, so it's not fatal. It depends on the size of your video. This happens when the width is not a multiple of 4. The next version has a new converter/scaler which can handle this, but it will still be slightly slower (I can't force the X11 server to add padding like I would do myself).

Quote: Shneekeythelost

Basically, as long as the screen is not moving, I get 30 FPS, when I start moving the cursor around, it drops down as low as 2-3 FPS.

I'm running an 8 core AM3+ 3.5 GHz Processor with 8 GB dual-channel DDR3 SDRAM, so I don't think I'm using up my memory or processing speed by any means.

When I set it up and use Preview, it doesn't have the problem, the preview follows along at 30 FPS perfectly well. It's only when I actually start streaming that it goes into the toilet.

Then it can't be the converter/scaler, it doesn't care about movement. And if the preview is unaffected, it must be the encoder. What size was the video? Does the problem go away if you use a smaller resolution?

Could you try to encode something with x264 in a different program, to see if it's also affected? You could use something like this:

ffmpeg -i somevideofile -c:v libx264 -preset fast -tune zerolatency -maxrate 3500k -bufsize 3500k -c:a libvorbis -b:a 128k test.mkv

Replace ffmpeg with avconv for Ubuntu/Debian. This should print a frame rate while it is encoding. Is this value also as low as it is in SSR?

Last modified: Tue, 26 Nov 2013, 0:28 (GMT+1, DST)

Shneekeythelost

Comment #29: Tue, 26 Nov 2013, 1:55 (GMT+1, DST)

Quote


I was trying to record in 480p (854 x 480).

Running Mint 15 64 bit, so effectively using Ubuntu/Debian stuff

Here's my output:

Quote

avconv version 0.8.9-6:0.8.9-0ubuntu0.13.04.1, Copyright (c) 2000-2013 the Libav developers
built on Nov 9 2013 19:09:48 with gcc 4.7.3
[matroska,webm @ 0x1df0d40] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'SCUpdate':
Duration: 00:05:21.13, start: 0.000000, bitrate: N/A
Stream #0.0: Video: vp8, yuv420p, 1280x720, PAR 1:1 DAR 16:9, 15 fps, 15 tbr, 1k tbn, 1k tbc (default)
Stream #0.1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
[buffer @ 0x1ea9940] w:1280 h:720 pixfmt:yuv420p
[libx264 @ 0x1df7a80] lookaheadless mb-tree requires intra refresh or infinite keyint
[libx264 @ 0x1df7a80] using SAR=1/1
[libx264 @ 0x1df7a80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX XOP FMA4 FMA3 SSEMisalign LZCNT BMI1 TBM
[libx264 @ 0x1df7a80] profile Main, level 3.1
[libx264 @ 0x1df7a80] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=8 sliced_threads=1 slices=8 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3500 vbv_bufsize=3500 crf_max=0.0 nal_hrd=none ip_ratio=1.25 aq=1:1.00
Output #0, matroska, to 'test.mkv':
Metadata:
encoder : Lavf53.21.1
Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 15 tbc (default)
Stream #0.1: Audio: libvorbis, 44100 Hz, stereo, s16, 128 kb/s (default)
Stream mapping:
Stream #0:0 -> #0:0 (vp8 -> libx264)
Stream #0:1 -> #0:1 (vorbis -> libvorbis)
Press ctrl-c to stop encoding
frame= 4817 fps= 31 q=13.0 Lsize= 124552kB time=321.08 bitrate=3177.8kbits/s
video:119203kB audio:5024kB global headers:4kB muxing overhead 0.258457%
[libx264 @ 0x1df7a80] frame I:27 Avg QP:21.07 size:106511
[libx264 @ 0x1df7a80] frame P:4790 Avg QP:23.69 size: 24883
[libx264 @ 0x1df7a80] mb I I16..4: 23.1% 0.0% 76.9%
[libx264 @ 0x1df7a80] mb P I16..4: 5.6% 0.0% 10.7% P16..4: 41.2% 12.5% 5.2% 0.0% 0.0% skip:24.8%
[libx264 @ 0x1df7a80] coded y,uvDC,uvAC intra: 61.2% 51.7% 15.8% inter: 32.0% 21.1% 3.6%
[libx264 @ 0x1df7a80] i16 v,h,dc,p: 20% 30% 35% 16%
[libx264 @ 0x1df7a80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 25% 28% 4% 3% 3% 4% 3% 4%
[libx264 @ 0x1df7a80] i8c dc,h,v,p: 63% 20% 16% 1%
[libx264 @ 0x1df7a80] Weighted P-Frames: Y:0.2% UV:0.0%
[libx264 @ 0x1df7a80] ref P L0: 82.8% 17.2%
[libx264 @ 0x1df7a80] kb/s:3040.81

So the FPS stayed a constant 31 throughout the entire encoding.

Maarten Baert

Administrator

Comment #30: Tue, 26 Nov 2013, 17:05 (GMT+1, DST)

Quote


@Shneekeythelost: Does this also happen in SSR when you record to a file instead of streaming?

Ubuntuaddicted

Comment #31: Tue, 26 Nov 2013, 22:44 (GMT+1, DST)

Quote


Quote: Shneekeythelost

I was trying to record in 480p (854 x 480).
Running Mint 15 64 bit, so effectively using Ubuntu/Debian stuff

So the FPS stayed a constant 31 throughout the entire encoding.

looking at the libav info, you're capturing 1280x720 stream and then streaming out that same resolution. what's your upload bandwidth from your ISP?

Last modified: Tue, 26 Nov 2013, 22:45 (GMT+1, DST)

Ubuntuaddicted

Comment #32: Wed, 27 Nov 2013, 4:52 (GMT+1, DST)

Quote


Quote: Maarten Baert

No, I mean the long list of error messages at the start (the h264 ones). That should not happen.

ah yes, that huge wall of errors. I've been a busy boy. I am using a static build of ffmpeg, here's the version info

ffmpeg version N-58456-ga9a3afe
built on Nov 26 2013 05:33:17 with gcc 4.6 (Debian 4.6.3-1)
configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
libavutil      52. 54.100 / 52. 54.100
libavcodec     55. 44.100 / 55. 44.100
libavformat    55. 21.102 / 55. 21.102
libavdevice    55.  5.100 / 55.  5.100
libavfilter     3. 91.100 /  3. 91.100
libswscale      2.  5.101 /  2.  5.101
libswresample   0. 17.104 /  0. 17.104
libpostproc    52.  3.100 / 52.  3.100

the static build is recent and will at least let me test all this stuff without messing up my video editing apps that rely on the currently installed ffmpeg/avconv. The good news is that I was able to make the following command work

./ffmpeg -f mpegts -i /dev/video1 -codec copy test.ts
ffmpeg version N-58456-ga9a3afe Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 26 2013 05:33:17 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 54.100 / 52. 54.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '/dev/video1':
  Duration: N/A, start: 0.387044, bitrate: 130 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 130 kb/s
Output #0, mpegts, to 'test.ts':
  Metadata:
    encoder         : Lavf55.21.102
    Stream #0:0: Video: h264 (HDMV / 0x564D4448), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 90k tbn, 59.94 tbc
    Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 130 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 3544 fps= 66 q=-1.0 Lsize=   43257kB time=00:00:59.17 bitrate=5988.0kbits/s    
video:38732kB audio:944kB subtitle:0 global headers:0kB muxing overhead 9.028214%
Received signal 2: terminating.

so we don't need the cat or piping. That command will keep recording until I manually cancel it.

The bad news is that when I run the full command

./ffmpeg -f mpegts -i /dev/video1 -c:v libx264 -preset veryfast -tune zerolatency -b:v 3500k -maxrate 3500k -bufsize 3500k -c:a aac -strict -2 -b:a 128k -y testfile.ts
ffmpeg version N-58456-ga9a3afe Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 26 2013 05:33:17 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 54.100 / 52. 54.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '/dev/video1':
  Duration: N/A, start: 0.387044, bitrate: 130 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 130 kb/s
[libx264 @ 0x3ed1160] using SAR=1/1
[libx264 @ 0x3ed1160] using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
[libx264 @ 0x3ed1160] profile High, level 3.2
Output #0, mpegts, to 'testfile.ts':
  Metadata:
    encoder         : Lavf55.21.102
    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 3500 kb/s, 90k tbn, 59.94 tbc
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> aac)
Press [q] to stop, [?] for help
[adts @ 0x4c4d560] Encoder did not produce proper pts, making some up.
frame=  304 fps=100 q=14.0 size=    2221kB time=00:00:05.09 bitrate=3568.4kbits/s dup=3 drop=0

the command appears to freeze in the terminal and the blue light on the HD-PVR turns off which means it's no longer encoding anything. :(
Any thoughts? Is there an email I could get from you so maybe we could communicate over skype or gmail voice chat maybe?

Shneekeythelost

Comment #33: Sat, 30 Nov 2013, 9:28 (GMT+1, DST)

Quote


I think I have found my problem, although it's a fairly unsolvable.

The codecs I'm using create HUGE files. For a half hour video recording, it's something like 3.5 to 4 GB. That's an enormous amount of data to be streaming. And that's at 480p. My computer can handle it, no sweat. My upstream speed, however, is only around 1 Mb/s, which isn't nearly enough.

Ubuntuaddicted

Comment #34: Sun, 1 Dec 2013, 14:45 (GMT+1, DST)

Quote


Quote: Shneekeythelost

I think I have found my problem, although it's a fairly unsolvable.

The codecs I'm using create HUGE files. For a half hour video recording, it's something like 3.5 to 4 GB. That's an enormous amount of data to be streaming. And that's at 480p. My computer can handle it, no sweat. My upstream speed, however, is only around 1 Mb/s, which isn't nearly enough.

you aren't streaming 480p, you're streaming 720p. You need to check your settings again, you can see per the ffmpeg output here:

Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 15 tbc (default)
Stream #0.1: Audio: libvorbis, 44100 Hz, stereo, s16, 128 kb/s (default)

You are also capturing in the same resolution as well as shown earlier in the ffmpeg output

Maarten Baert

Administrator

Comment #35: Sun, 1 Dec 2013, 22:16 (GMT+1, DST)

Quote


@Ubuntuaddicted: I think I understand what's happening. Your /dev/video1 probably expects programs to read all the data as soon as it becomes available. Ffmpeg may simply be reading too slowly. I still think you should try it with

cat /dev/video1 | ffmpeg -f mpegts -i - ...

because there's a chance that this will work. Something else you could try is

buffer -i /dev/video1 -m 20M | ffmpeg -f mpegts -i - ...

'buffer' is a tool that should be in the Ubuntu repositories. This will buffer up to 20MB of data (instead of the 64kb of a normal pipe).

Last modified: Sun, 1 Dec 2013, 22:18 (GMT+1, DST)

Shneekeythelost

Comment #36: Mon, 2 Dec 2013, 8:40 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Shneekeythelost

I think I have found my problem, although it's a fairly unsolvable.

The codecs I'm using create HUGE files. For a half hour video recording, it's something like 3.5 to 4 GB. That's an enormous amount of data to be streaming. And that's at 480p. My computer can handle it, no sweat. My upstream speed, however, is only around 1 Mb/s, which isn't nearly enough.

you aren't streaming 480p, you're streaming 720p. You need to check your settings again, you can see per the ffmpeg output here:

Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 15 tbc (default)
Stream #0.1: Audio: libvorbis, 44100 Hz, stereo, s16, 128 kb/s (default)

You are also capturing in the same resolution as well as shown earlier in the ffmpeg output

Ummm... no.

First off, I'm not using libvorbis, I'm using AAC when recording.

Second off, the video I tested in ffmpeg was 720p, which is why, when I used the 'default' tag, it recorded in 720p. If you read the posted request, it was a request to check the speed at which I process video. As you might have noticed, I didn't have a problem with that, even in 720p.

However, when I record, I do so in 480p. I play windowed mode in 480p, which kinda makes it really hard to record it in 720p when the window being recorded isn't that big. And, in case you didn't notice, there's a big huge screen in the SSR interface called 'video input' where you can put in the width and height of the recording area. So it would be really hard to screw that one up, particularly when you just click 'select window'.

So I can definitively state that I am, indeed, recording in 480p. And it is still producing ridiculously huge files. Even when I decided to start leveraging my CPU to try and reduce file size and used 'medium' rather than 'ultrafast', it didn't really drop the file size much.

I have now recorded seven episodes, and all of them stayed at a constant 30 FPS when recording and not streaming.

Last modified: Mon, 2 Dec 2013, 8:41 (GMT+1, DST)

Ubuntuaddicted

Comment #37: Wed, 4 Dec 2013, 13:51 (GMT+1, DST)

Quote


I am trying to record some Life Goes On, using standard settings the preview shows up fine and it appears like it records but when I open the resulting mp4 file parole media player says the file contains no playable streams. So I thought maybe I need to use the opengl recording, i follow the steps but when I hit play within the steam client the game window pops up for a moment and then goes away. So i am guessing your software just doesn't work with recording this game then?

It's a free demo from the steam client if you want to test recording the game out yourself

Maarten Baert

Administrator

Comment #38: Thu, 5 Dec 2013, 22:07 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

I am trying to record some Life Goes On, using standard settings the preview shows up fine and it appears like it records but when I open the resulting mp4 file parole media player says the file contains no playable streams. So I thought maybe I need to use the opengl recording, i follow the steps but when I hit play within the steam client the game window pops up for a moment and then goes away. So i am guessing your software just doesn't work with recording this game then?

It's a free demo from the steam client if you want to test recording the game out yourself

Weird, I downloaded the demo and it works just fine here, both with X11 recording and OpenGL recording. And that's on Arch Linux, which isn't even the official target platform :S.

I don't think any program could cause X11 to fail, so if the MP4 is empty, that probably means something else went wrong. Try to enable the preview in SimpleScreenRecorder and make sure that both video and audio are working correctly.

I wouldn't be surprised if some games are incompatible with OpenGL recording, but if that's the case I don't understand why it does work for me.

Try launching Steam from a terminal (but first close Steam completely) and look at the messages you get when you try to start the game with OpenGL recording.

Last modified: Thu, 5 Dec 2013, 22:18 (GMT+1, DST)

Crowiz

Comment #39: Sat, 7 Dec 2013, 7:03 (GMT+1, DST)

Quote


Is there an option to start the program from shell / cron, in a way that it starts streaming without interaction from GUI. I would like, for example to restart streaming session via SSH.

Maarten Baert

Administrator

Comment #40: Sat, 7 Dec 2013, 15:47 (GMT+1, DST)

Quote


Quote: Crowiz

Is there an option to start the program from shell / cron, in a way that it starts streaming without interaction from GUI. I would like, for example to restart streaming session via SSH.

It's not that simple, if you start it over SSH it would try to record your X11 display. If you give it the right display, it will work but you will not see the GUI since it's on the remote display.

At the moment there is no way to use it without the GUI, but I will add that at some point.

There is a patch that will allow you to record one screen while showing the GUI on a different screen. It's here:
https://github.com/MaartenBaert/ssr/pull/74
I haven't merged it with the master branch because I'm not completely happy with the modified GUI yet, so if you want this you have to build it yourself.

Last modified: Sat, 7 Dec 2013, 15:48 (GMT+1, DST)

Ubuntuaddicted

Comment #41: Sun, 8 Dec 2013, 1:22 (GMT+1, DST)

Quote


Quote: Maarten Baert

@Ubuntuaddicted: I think I understand what's happening. Your /dev/video1 probably expects programs to read all the data as soon as it becomes available. Ffmpeg may simply be reading too slowly. I still think you should try it with

cat /dev/video1 | ffmpeg -f mpegts -i - ...

because there's a chance that this will work. Something else you could try is

buffer -i /dev/video1 -m 20M | ffmpeg -f mpegts -i - ...

'buffer' is a tool that should be in the Ubuntu repositories. This will buffer up to 20MB of data (instead of the 64kb of a normal pipe).

maybe you missed my reply but using a static ffmpeg build and trying

./ffmpeg -f mpegts -i /dev/video1 -codec copy test5.ts

results in the terminal command freezing after about 30 seconds and the hd-pvr recording light shutting off on its own. Here's the terminal ouput from running that

ffmpeg version N-58456-ga9a3afe Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 26 2013 05:33:17 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 54.100 / 52. 54.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '/dev/video1':
  Duration: N/A, start: 0.387044, bitrate: 115 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 115 kb/s
Output #0, mpegts, to 'test5.ts':
  Metadata:
    encoder         : Lavf55.21.102
    Stream #0:0: Video: h264 (HDMV / 0x564D4448), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 90k tbn, 59.94 tbc
    Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 115 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
^Came= 1373 fps= 69 q=-1.0 size=   20178kB time=00:00:22.95 bitrate=7201.0kbits/s    

And trying it with the buffer command piped into the static ffmpeg results in the stream never getting started, stops at here

buffer -i /dev/video1 -m 20M | ./ffmpeg -f mpegts -i /dev/video1 -codec copy test.ts
ffmpeg version N-58456-ga9a3afe Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 26 2013 05:33:17 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 54.100 / 52. 54.100
  libavcodec     55. 44.100 / 55. 44.100
  libavformat    55. 21.102 / 55. 21.102
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100

Well, due to not figuring this out yet and me really wanting to live stream my xbox 360 gameplay I have installed windows 7 on another machine I own and am streaming to twitch with the other external capture device I own, the elgato game capture hd. maybe 1 day I can use linux for both desktop & console gameplay screencasting as well as be able to stream either or. but for now I have to use 2 different OS's and 2 different capture devices.

Thanks for trying to get this to work though, your efforts are notable

Last modified: Sun, 8 Dec 2013, 1:41 (GMT+1, DST)

Maarten Baert

Administrator

Comment #42: Sun, 8 Dec 2013, 19:09 (GMT+1, DST)

Quote


Giving up already? :P

I did read your comment. Of course it doesn't work like that, the command is wrong. You are doing:

buffer -i /dev/video1 -m 20M | ./ffmpeg -f mpegts -i /dev/video1 -codec copy test.ts

It should be:

buffer -i /dev/video1 -m 20M | ./ffmpeg -f mpegts -i - -codec copy test.ts

I still think you should enable transcoding because that's less likely to fail, i.e.:

buffer -i /dev/video1 -m 20M | ./ffmpeg -f mpegts -i - -c:v libx264 -preset veryfast -tune zerolatency -maxrate 3500k -bufsize 3500k -c:a libvorbis -b:a 128k test.mkv
Ubuntuaddicted

Comment #43: Thu, 26 Dec 2013, 15:04 (GMT+1, DST)

Quote


I'm giving up on the HD-PVR for now since I got livestreaming working with my Xbox 360 using a Windows 7 machine and an Elgato Game Capture HD BUT now I am having issues livestreaming my desktop to twitch OR hitbox. I am trying to stream my entire desktop (1680x1050) when I am playing Metro: Last Light but the video is just a black screen but there is audio. I tried using the opengl streaming but the game won't even start when I use those game launch options. What's very strange is that it streams just fine if I play the game in a 1024x768 window and choose to stream that window. I then upscale it to 1280x720 so I get a 16:9 resolution. Any thoughts as to why the video is just a black screen and I have audio?

Maarten Baert

Administrator

Comment #44: Thu, 26 Dec 2013, 15:39 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

I'm giving up on the HD-PVR for now since I got livestreaming working with my Xbox 360 using a Windows 7 machine and an Elgato Game Capture HD BUT now I am having issues livestreaming my desktop to twitch OR hitbox. I am trying to stream my entire desktop (1680x1050) when I am playing Metro: Last Light but the video is just a black screen but there is audio. I tried using the opengl streaming but the game won't even start when I use those game launch options. What's very strange is that it streams just fine if I play the game in a 1024x768 window and choose to stream that window. I then upscale it to 1280x720 so I get a 16:9 resolution. Any thoughts as to why the video is just a black screen and I have audio?

What video card and drivers are you using? Also, what is your normal screen resolution?

Did you get any messages in the SSR log at ~/.ssr?

Ubuntuaddicted

Comment #45: Sat, 28 Dec 2013, 19:41 (GMT+1, DST)

Quote


i have an XFX HD7770 Black Edition and I am using the AMD Catalyst Driver from their website, the latest one, version 13.12. My normal desktop resolution is 1680x1050, that's the max my monitor can handle.
I noticed some audio errors. Here;s a clip from the log but it's a gigantic 434MB file which just keeps repeating the audio error

[1;33m[Synchronizer::ReadVideoFrame] Warning: Video buffer overflow, some frames will be lost. The audio input seems to be too slow.
[Synchronizer::ReadAudioSamples] Warning: Desynchronization is too high, starting new segment to keep the audio in sync with the video (some video and/or audio may be lost).
[Synchronizer::ReadAudioSamples] Warning: Desynchronization is too high, starting new segment to keep the audio in sync with the video (some video and/or audio may be lost).
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.

I am using pulseaudio loopbacks so that it records the game audio as well as audio from my logitech c260 webcam and then SSR just records the 1 virtual output called mic+game

So currently I am just playing the game in windowed mode and this game doesn't allow for custom resolutions, so when it's not fullscreen it just defaults to 1024x768 and then I am using the scaler to scale it to 1280x720. It looks alright I guess. My computer probably isn't powerful enough to stream 1680x1050 anyway.
Any other suggestions for the black screen when trying to stream my full desktop?

One thing I was going to ask was about setting the keyframe interval, twitch and now hitbox is requiring that the keyframe interval be set to 2, and I notice in the log there's these 2 items keyint=250 keyint_min=25, is there a way to make those 2?

Last modified: Sun, 29 Dec 2013, 8:10 (GMT+1, DST)

Maarten Baert

Administrator

Comment #46: Mon, 30 Dec 2013, 18:21 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

i have an XFX HD7770 Black Edition and I am using the AMD Catalyst Driver from their website, the latest one, version 13.12. My normal desktop resolution is 1680x1050, that's the max my monitor can handle.
I noticed some audio errors. Here;s a clip from the log but it's a gigantic 434MB file which just keeps repeating the audio error

[1;33m[Synchronizer::ReadVideoFrame] Warning: Video buffer overflow, some frames will be lost. The audio input seems to be too slow.
[Synchronizer::ReadAudioSamples] Warning: Desynchronization is too high, starting new segment to keep the audio in sync with the video (some video and/or audio may be lost).
[Synchronizer::ReadAudioSamples] Warning: Desynchronization is too high, starting new segment to keep the audio in sync with the video (some video and/or audio may be lost).
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.

I am using pulseaudio loopbacks so that it records the game audio as well as audio from my logitech c260 webcam and then SSR just records the 1 virtual output called mic+game

Your audio seems to be totally broken (probably more PulseAudio bugs that I just haven't seen yet). The next version will have JACK support, that would probably fix those issues (it is harder to configure though). At some point I want to add support for multiple audio streams, that would probably also fix it. For now, consider recording without game sound, it may help.

The black screen is probably unrelated. Your window manager is probably 'unredirecting' fullscreen games and the AMD driver apparently can't record when that happens. Try to find an option to disable unredirection either in your window manager or driver settings. OpenGL recording would fix this too, but if that crashes that's obviously not an option. I don't have that game so I can't test it. I am currently rewriting the OpenGL recording system, it's possible that this will fix the crashes.

I've answered your other question in the 'custom codec options' article.

Ubuntuaddicted

Comment #47: Wed, 1 Jan 2014, 3:04 (GMT+1, DST)

Quote


Quote: Maarten Baert

Your audio seems to be totally broken (probably more PulseAudio bugs that I just haven't seen yet). The next version will have JACK support, that would probably fix those issues (it is harder to configure though). At some point I want to add support for multiple audio streams, that would probably also fix it. For now, consider recording without game sound, it may help.

The black screen is probably unrelated. Your window manager is probably 'unredirecting' fullscreen games and the AMD driver apparently can't record when that happens. Try to find an option to disable unredirection either in your window manager or driver settings. OpenGL recording would fix this too, but if that crashes that's obviously not an option. I don't have that game so I can't test it. I am currently rewriting the OpenGL recording system, it's possible that this will fix the crashes.

I've answered your other question in the 'custom codec options' article.

i think i found the problem, i don't know how BUT looking at my /etc/pulse/default.pa the

default-sample-rate = 44100 

setting was 96000 for some reason. Which I believe was also causing pulseaudio to crash whenever I tried enabling a virtual stream which would simultaneously send audio to all sound cards. It's also a bug related to the trivial_resampler.c that was patched in pulseaudio 3.0 but since changing the value from 96000 to 44100 pulseaudio isn't crashing anymore. I haven't tried to stream again yet though so not sure if that solved my audio errors. I also haven't tried to stream a fullscreen game again because I have been outputting a second display over hdmi to an elgato game capture hd that's connected to another computer running windows 7. takes a ton of heavy lifting off this machine which I use to game on. I'll try the fullscreen gaming and streaming again sometime soon though and let you know. I use XFCE so I wouldn't know where to change this unredirection setting you're talking about.

Ubuntuaddicted

Comment #48: Thu, 2 Jan 2014, 22:30 (GMT+1, DST)

Quote


I have read that a Black Magic Intensity Pro works in linux by using the gstreamer framework or something like that and may even come with it's own linux software for recording. I'm curious if your software would be able to grab the encoded stream from the hardware encoder and stream that twitch or hitbox?

Maarten Baert

Administrator

Comment #49: Fri, 3 Jan 2014, 0:37 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

I have read that a Black Magic Intensity Pro works in linux by using the gstreamer framework or something like that and may even come with it's own linux software for recording. I'm curious if your software would be able to grab the encoded stream from the hardware encoder and stream that twitch or hitbox?

Depends on how they expose the device. Apparently there's a GStreamer plugin but that's from a different company, so I assume the driver itself is a custom library (i.e. not video4linux2 since that wouldn't require a custom plugin). The license will probably be proprietary which complicates things a bit (I'm surprised a GStreamer plugin exists, actually).

It would be possible to support a proprietary API in SSR using the new OpenGL recording protocol, because I've changed some things so it's not specific to OpenGL anymore. It's not particularly hard, but I can't do this without access to the hardware, drivers and libraries. So you will have to do it yourself or find a programmer that can do it for you ...

I could also add a GStreamer input, but that would add a massive dependency that I wanted to avoid, and you would still have to buy the GStreamer plugin for the device (it's not free).

Quote: Ubuntuaddicted

I use XFCE so I wouldn't know where to change this unredirection setting you're talking about.

Assuming compositing is enabled:
Window Manager Tweaks > Compositor > uncheck 'Display fullscreen overlay windows directly'

Please tell me whether that worked, I've heard a similar bug report before and I think I now know why.

Last modified: Fri, 3 Jan 2014, 0:40 (GMT+1, DST)

Nismo

Comment #50: Sat, 4 Jan 2014, 22:56 (GMT+1, DST)

Quote


Hello i have one big problem with streaming now

all was work good, but one day happends something bad

now i cant streaming on twitch, my channel saying only: "Loading stream", but when i try to look on past broadcast then i can see all what i recorded, but live cant

problem isnt in SSR, becose i tried ffmpeg script and it do same but maybe u will know solution..

i have no problem with browser/internet becose other streams works and when i streaming from WIN7 my stream works fine, and other friends tell me that they see only "loading stream" too

i tried reinstall ffmpeg, codecs etc...

but its 100% problem in my distro, maybe with encoding i really dont know

distro kubuntu 13.10

sorry for my bad english and thank u for help.

edit 1: recorded my channel/other channel, here u can see loading stream vs working stream

http://www.twitch.tv/linuxak/b/492693683

Last modified: Sat, 4 Jan 2014, 23:13 (GMT+1, DST)

Maarten Baert

Administrator

Comment #51: Sat, 4 Jan 2014, 23:57 (GMT+1, DST)

Quote


Quote: Nismo

Hello i have one big problem with streaming now

all was work good, but one day happends something bad

now i cant streaming on twitch, my channel saying only: "Loading stream", but when i try to look on past broadcast then i can see all what i recorded, but live cant

problem isnt in SSR, becose i tried ffmpeg script and it do same but maybe u will know solution..

i have no problem with browser/internet becose other streams works and when i streaming from WIN7 my stream works fine, and other friends tell me that they see only "loading stream" too

i tried reinstall ffmpeg, codecs etc...

but its 100% problem in my distro, maybe with encoding i really dont know

distro kubuntu 13.10

sorry for my bad english and thank u for help.

edit 1: recorded my channel/other channel, here u can see loading stream vs working stream

http://www.twitch.tv/linuxak/b/492693683

To debug this I will need to see what settings you used, and the full log file. Both are saved in the ~/.ssr directory (settings.conf and the relevant log file). Can you upload those? Note: The settings file will contain your stream key, so you should remove it or make sure that the key has expired.

Nismo

Comment #52: Sun, 5 Jan 2014, 0:37 (GMT+1, DST)

Quote


Maarten:

settings
http://pastebin.com/8jtQPPMi

but no relevant log file there, i mean SSR doesnt make log file. (there were only some older log files)

Maarten Baert

Administrator

Comment #53: Sun, 5 Jan 2014, 21:43 (GMT+1, DST)

Quote


Quote: Nismo

Maarten:

settings
http://pastebin.com/8jtQPPMi

but no relevant log file there, i mean SSR doesnt make log file. (there were only some older log files)

Your settings are broken, and you didn't follow all the instructions on this page. In particular:
- 1366x768 is a weird resolution, it's usually better to use a more common resolution, like 1280x720.
- A bit rate of 460kbps is WAAAAY too low. You need ~2000kbps for 720p, and ~3000kbps for 1080p. 460kbps is not even enough for 360p.
- If you want strict constant bit rate, use the same value for minrate and maxrate.
- I would recommand AAC instead of MP3, but MP3 should work too.
- Consider adding tune=zerolatency to the codec options.

Even with your broken settings I am still able to stream, but it is very buggy and the quality is unusable.

Nismo

Comment #54: Sun, 5 Jan 2014, 22:49 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Nismo

Maarten:

settings
http://pastebin.com/8jtQPPMi

but no relevant log file there, i mean SSR doesnt make log file. (there were only some older log files)

Your settings are broken, and you didn't follow all the instructions on this page. In particular:
- 1366x768 is a weird resolution, it's usually better to use a more common resolution, like 1280x720.
- A bit rate of 460kbps is WAAAAY too low. You need ~2000kbps for 720p, and ~3000kbps for 1080p. 460kbps is not even enough for 360p.
- If you want strict constant bit rate, use the same value for minrate and maxrate.
- I would recommand AAC instead of MP3, but MP3 should work too.
- Consider adding tune=zerolatency to the codec options.

Even with your broken settings I am still able to stream, but it is very buggy and the quality is unusable.

I streaming witn 360p,450p,540p, more not (and if u stream 2D u dont need better bitrate)
my settings are good for this HW/upload speed (600-700 kbps)
my problem is that i am not able to stream (loading video), its not about setting in SSR, becose this settings works on dualboot other linux, and ffmpeg script do same (loading video). I mean problem is something else.

Thanks

Maarten Baert

Administrator

Comment #55: Mon, 6 Jan 2014, 2:16 (GMT+1, DST)

Quote


Quote: Nismo

I streaming witn 360p,450p,540p, more not (and if u stream 2D u dont need better bitrate)
my settings are good for this HW/upload speed (600-700 kbps)
my problem is that i am not able to stream (loading video), its not about setting in SSR, becose this settings works on dualboot other linux, and ffmpeg script do same (loading video). I mean problem is something else.

That's possible, Ubuntu uses libav instead of ffmpeg, but what's worse is that their libav is now almost two years old - they haven't updated it since 12.04 I think. So if you can get the latest ffmpeg, that will probably help.

Edit: Maybe try this PPA - at your own risk, I've not tried it ;):
https://launchpad.net/~jon-severinsson/+archive/ffmpeg

Last modified: Mon, 6 Jan 2014, 2:18 (GMT+1, DST)

Ubuntuaddicted

Comment #56: Wed, 15 Jan 2014, 17:15 (GMT+1, DST)

Quote


Quote: Maarten Baert

Assuming compositing is enabled:
Window Manager Tweaks > Compositor > uncheck 'Display fullscreen overlay windows directly'

Please tell me whether that worked, I've heard a similar bug report before and I think I now know why.

i don't have any compositing enabled within my XFCE 4.10. I still can't stream fullscreen, there's only a black screen being streamed. Even such a simple game like Cave Story+

Ubuntuaddicted

Comment #57: Wed, 15 Jan 2014, 17:33 (GMT+1, DST)

Quote


Quote: Nismo

Hello i have one big problem with streaming now

all was work good, but one day happends something bad

now i cant streaming on twitch, my channel saying only: "Loading stream", but when i try to look on past broadcast then i can see all what i recorded, but live cant

problem isnt in SSR, becose i tried ffmpeg script and it do same but maybe u will know solution..

i have no problem with browser/internet becose other streams works and when i streaming from WIN7 my stream works fine, and other friends tell me that they see only "loading stream" too

i tried reinstall ffmpeg, codecs etc...

but its 100% problem in my distro, maybe with encoding i really dont know

distro kubuntu 13.10

sorry for my bad english and thank u for help.

edit 1: recorded my channel/other channel, here u can see loading stream vs working stream

http://www.twitch.tv/linuxak/b/492693683

i've experienced this "loading stream" issue before. It's either your browsers cache of your own stream OR just simple stop and restart ssr. If you enable the preview, does it show an image?

I would also say try to stream without using the scaler, your native resolution is 1366x768 and then you're scaling it down to 960x540. Are you sure you've successfully streamed that resolution before? I've heard of 1080p, 720p, 480p, 360p but never 540p. It's possible twitch or hitbox (whoever you're streaming to) doesn't allow weird resolutions because there viewer can't properly display it.

Cowedoffacliff

Comment #58: Thu, 16 Jan 2014, 11:12 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Ubuntuaddicted

i have an XFX HD7770 Black Edition and I am using the AMD Catalyst Driver from their website, the latest one, version 13.12. My normal desktop resolution is 1680x1050, that's the max my monitor can handle.
I noticed some audio errors. Here;s a clip from the log but it's a gigantic 434MB file which just keeps repeating the audio error

[1;33m[Synchronizer::ReadVideoFrame] Warning: Video buffer overflow, some frames will be lost. The audio input seems to be too slow.
[Synchronizer::ReadAudioSamples] Warning: Desynchronization is too high, starting new segment to keep the audio in sync with the video (some video and/or audio may be lost).
[Synchronizer::ReadAudioSamples] Warning: Desynchronization is too high, starting new segment to keep the audio in sync with the video (some video and/or audio may be lost).
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.
[Synchronizer::ReadAudioSamples] Warning: Received audio samples with non-monotonic timestamp.

I am using pulseaudio loopbacks so that it records the game audio as well as audio from my logitech c260 webcam and then SSR just records the 1 virtual output called mic+game

Your audio seems to be totally broken (probably more PulseAudio bugs that I just haven't seen yet). The next version will have JACK support, that would probably fix those issues (it is harder to configure though). At some point I want to add support for multiple audio streams, that would probably also fix it. For now, consider recording without game sound, it may help.

The black screen is probably unrelated. Your window manager is probably 'unredirecting' fullscreen games and the AMD driver apparently can't record when that happens. Try to find an option to disable unredirection either in your window manager or driver settings. OpenGL recording would fix this too, but if that crashes that's obviously not an option. I don't have that game so I can't test it. I am currently rewriting the OpenGL recording system, it's possible that this will fix the crashes.

I've answered your other question in the 'custom codec options' article.

I would like to confirm that I am now having similar audio issues. I wanted to record both game audio and microphone audio so I followed the instructions you posted and got them working when I made test files saved to disk. However, as soon as I started trying to stream, I immediately ran into a brick wall. As soon as my stream file size hit around 4400kb (I assume this is where the the desynch begins consistently for an unknown reason) SSR would crash with no errors. Today I cloned the git repo and ran from compiled source which resulted in my finally getting this same audio desynching errors experienced by UbuntuAddicted. I assume what happens is as soon as it desynchs too far a new segment is inserted in order to try and recover; however, as soon as a new segment is inserted the stream immediately quits out which causes the poor RTMP implementation in FFMPEG to immediately crash SSR. I assume I didn't notice the segment insertion in my test videos originally because it's not as critical when you're just recording a video and saving it to disk.

Last modified: Thu, 16 Jan 2014, 11:14 (GMT+1, DST)

Ubuntuaddicted

Comment #59: Thu, 16 Jan 2014, 22:43 (GMT+1, DST)

Quote


Quote: Cowedoffacliff

I would like to confirm that I am now having similar audio issues. I wanted to record both game audio and microphone audio so I followed the instructions you posted and got them working when I made test files saved to disk. However, as soon as I started trying to stream, I immediately ran into a brick wall. As soon as my stream file size hit around 4400kb (I assume this is where the the desynch begins consistently for an unknown reason) SSR would crash with no errors. Today I cloned the git repo and ran from compiled source which resulted in my finally getting this same audio desynching errors experienced by UbuntuAddicted. I assume what happens is as soon as it desynchs too far a new segment is inserted in order to try and recover; however, as soon as a new segment is inserted the stream immediately quits out which causes the poor RTMP implementation in FFMPEG to immediately crash SSR. I assume I didn't notice the segment insertion in my test videos originally because it's not as critical when you're just recording a video and saving it to disk.

FYI, you must have missed that I solved my problem and I don't experience the issue anymore. It was my /etc/pulse/default.pa file, the default sample rate was not set (or it was set to 48000 I forget), since I changed it to

default-sample-rate = 44100

I just streamed last night to hitbox, both Shank 2 and Bastion for about 3 hours total and never had an issue.

Cowedoffacliff

Comment #60: Fri, 17 Jan 2014, 6:09 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Cowedoffacliff

I would like to confirm that I am now having similar audio issues. I wanted to record both game audio and microphone audio so I followed the instructions you posted and got them working when I made test files saved to disk. However, as soon as I started trying to stream, I immediately ran into a brick wall. As soon as my stream file size hit around 4400kb (I assume this is where the the desynch begins consistently for an unknown reason) SSR would crash with no errors. Today I cloned the git repo and ran from compiled source which resulted in my finally getting this same audio desynching errors experienced by UbuntuAddicted. I assume what happens is as soon as it desynchs too far a new segment is inserted in order to try and recover; however, as soon as a new segment is inserted the stream immediately quits out which causes the poor RTMP implementation in FFMPEG to immediately crash SSR. I assume I didn't notice the segment insertion in my test videos originally because it's not as critical when you're just recording a video and saving it to disk.

FYI, you must have missed that I solved my problem and I don't experience the issue anymore. It was my /etc/pulse/default.pa file, the default sample rate was not set (or it was set to 48000 I forget), since I changed it to

default-sample-rate = 44100

I just streamed last night to hitbox, both Shank 2 and Bastion for about 3 hours total and never had an issue.

Oh good to know. I'll go change that and make sure it works.

Nismo

Comment #61: Mon, 20 Jan 2014, 16:47 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Nismo

Hello i have one big problem with streaming now

all was work good, but one day happends something bad

now i cant streaming on twitch, my channel saying only: "Loading stream", but when i try to look on past broadcast then i can see all what i recorded, but live cant

problem isnt in SSR, becose i tried ffmpeg script and it do same but maybe u will know solution..

i have no problem with browser/internet becose other streams works and when i streaming from WIN7 my stream works fine, and other friends tell me that they see only "loading stream" too

i tried reinstall ffmpeg, codecs etc...

but its 100% problem in my distro, maybe with encoding i really dont know

distro kubuntu 13.10

sorry for my bad english and thank u for help.

edit 1: recorded my channel/other channel, here u can see loading stream vs working stream

http://www.twitch.tv/linuxak/b/492693683

i've experienced this "loading stream" issue before. It's either your browsers cache of your own stream OR just simple stop and restart ssr. If you enable the preview, does it show an image?

I would also say try to stream without using the scaler, your native resolution is 1366x768 and then you're scaling it down to 960x540. Are you sure you've successfully streamed that resolution before? I've heard of 1080p, 720p, 480p, 360p but never 540p. It's possible twitch or hitbox (whoever you're streaming to) doesn't allow weird resolutions because there viewer can't properly display it.

i can set what i want, still loading screen and i using old script ffmpeg whitch works time ago, and SSR with this configuration too but now not

but i found more informations about this issue: (same issue)
http://help.twitch.tv/customer/portal/questions/4740253-twitch-is-saving-videos-but-not-actually-streaming-them-

https://github.com/wargio/Twitch-Streamer-Linux/issues/10

Last modified: Mon, 20 Jan 2014, 16:48 (GMT+1, DST)

Ubuntuaddicted

Comment #62: Mon, 20 Jan 2014, 18:48 (GMT+1, DST)

Quote


Quote: Nismo

i can set what i want, still loading screen and i using old script ffmpeg whitch works time ago, and SSR with this configuration too but now not

but i found more informations about this issue: (same issue)
http://help.twitch.tv/customer/portal/questions/4740253-twitch-is-saving-videos-but-not-actually-streaming-them-

https://github.com/wargio/Twitch-Streamer-Linux/issues/10

sure you "can" stream whatever you want BUT this "could" rule out possible conflicts if you were to choose a more command resolution. maybe twitch changed something on their end and now don't allow weird resolutions?
the problem is most likely on twitch's or hitbox's end. i'm seeing many others tweeting about the same issue. although i was able to stream using ssr on sunday for almost 7+ hours and besides a few times having the black screen issue WITH audio just retarting the ssr seemed to fix the issue. also, i noticed that since using ssr we can't set the keyint, you really need to wait over 1 minute for your stream to load

Last modified: Mon, 20 Jan 2014, 18:49 (GMT+1, DST)

Nismo

Comment #63: Mon, 20 Jan 2014, 20:29 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Nismo

i can set what i want, still loading screen and i using old script ffmpeg whitch works time ago, and SSR with this configuration too but now not

but i found more informations about this issue: (same issue)
http://help.twitch.tv/customer/portal/questions/4740253-twitch-is-saving-videos-but-not-actually-streaming-them-

https://github.com/wargio/Twitch-Streamer-Linux/issues/10

sure you "can" stream whatever you want BUT this "could" rule out possible conflicts if you were to choose a more command resolution. maybe twitch changed something on their end and now don't allow weird resolutions?
the problem is most likely on twitch's or hitbox's end. i'm seeing many others tweeting about the same issue. although i was able to stream using ssr on sunday for almost 7+ hours and besides a few times having the black screen issue WITH audio just retarting the ssr seemed to fix the issue. also, i noticed that since using ssr we can't set the keyint, you really need to wait over 1 minute for your stream to load

i tried with native resolution and still cant streaming :/

Maarten Baert

Administrator

Comment #64: Mon, 20 Jan 2014, 21:49 (GMT+1, DST)

Quote


Quote: Nismo

i tried with native resolution and still cant streaming :/

Consider compiling from source (i.e. get the latest version from the glinject-next branch, it has the keyint option). It works great for me (but then again, the current stable SSR also worked fine).

Ubuntuaddicted

Comment #65: Mon, 20 Jan 2014, 21:58 (GMT+1, DST)

Quote


Quote: Nismo

i tried with native resolution and still cant streaming :/

i don't know, can you post your settings file contents AND your log file to pastebin and then post those links here? I've been streaming just fine to twitch and hitbox and maartin stated it's working for him so I am guessing it's something in your configuration or stream settings.

have you tried only streaming a window versus fullscreen? i have trouble streaming fullscreen as well for some reason.

Nismo

Comment #66: Tue, 21 Jan 2014, 18:07 (GMT+1, DST)

Quote


i tried default 5+ different ffmpeg scripts and SSR different options and still cant streaming, but sometimes stream loaded good, but when i did turn off and than i turn on stream it didnt load again. Maybe if u can pastebin me your working ffmpeg script or SSR config file and i will try it. Thank u

Ubuntuaddicted

Comment #67: Tue, 21 Jan 2014, 19:09 (GMT+1, DST)

Quote


Quote: Nismo

i tried default 5+ different ffmpeg scripts and SSR different options and still cant streaming, but sometimes stream loaded good, but when i did turn off and than i turn on stream it didnt load again. Maybe if u can pastebin me your working ffmpeg script or SSR config file and i will try it. Thank u

i too have experienced this issue as well in the past. when you stop and restart ssr it just doesn't want to load on hitbox (twitch I never have an issue with restarting). i would either get the "stream loading" issue OR a black screen with only audio no video. BUT I can say for sure that last night I stopped and restarted ssr a couple times and the stream popped right back up since i compiled and am using maartin's glinject-next branch. If you're using hitbox I believe their cutting alogrythm is different than twitch's and since they expect to see a keyframe every 2 seconds and you're stream only has a keyframe about every 8 seconds (for 30 FPS stream) than it causes this weird stream loading issue.

I would suggest trying maartin's glinject-next branch within git. So far I am having success with it. The README.md file has all the neccessary steps in order to build and install it, it's very easy all done with a simple script AFTER you remove the ppa version that's installed.

Good luck

PS I will say that your upload speed is critical to a successful stream, I suggest choosing a bitrate that's at least half of what your upload speed is. So if you use speedtest.net and check your upload against a server near 1 of the twitch server locations like chicago and it returns a result of 1Mbps, than your maxrate, bufsize, and bitrate should all be no more than 500 which is 500Kbps or .5Mbps.

Last modified: Tue, 21 Jan 2014, 19:13 (GMT+1, DST)

Nismo

Comment #68: Wed, 22 Jan 2014, 17:29 (GMT+1, DST)

Quote


thank u, i will try maartin's glinject-next SSR and will see

i had set keyframe on 2 on ffmpeg script and didnt help...
my upload is really really bad, but i am still able to stream desktop or 2D apps, and 3D apps aswell in 360/450/520p. But in future i will have way better upload. Nearest twitch server is only cca 400km from me, its fine than

Ubuntuaddicted

Comment #69: Wed, 22 Jan 2014, 19:06 (GMT+1, DST)

Quote


Quote: Nismo

thank u, i will try maartin's glinject-next SSR and will see

i had set keyframe on 2 on ffmpeg script and didnt help...
my upload is really really bad, but i am still able to stream desktop or 2D apps, and 3D apps aswell in 360/450/520p. But in future i will have way better upload. Nearest twitch server is only cca 400km from me, its fine than

when you thought you added keyframe interval to 2 for ffmpeg script, how did you add it?

I am not sure why you're getting the grey screen issue as I can stream just fine. Are you sure you're using a low enough bitrate for your bad upload? when you view your twitch dashboard have you checked what your stream quality is per twitch? cause if it's of poor quality they won't even stream it i believe.

Last modified: Wed, 22 Jan 2014, 19:10 (GMT+1, DST)

Nismo

Comment #70: Wed, 22 Jan 2014, 22:59 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Nismo

thank u, i will try maartin's glinject-next SSR and will see

i had set keyframe on 2 on ffmpeg script and didnt help...
my upload is really really bad, but i am still able to stream desktop or 2D apps, and 3D apps aswell in 360/450/520p. But in future i will have way better upload. Nearest twitch server is only cca 400km from me, its fine than

when you thought you added keyframe interval to 2 for ffmpeg script, how did you add it?

I am not sure why you're getting the grey screen issue as I can stream just fine. Are you sure you're using a low enough bitrate for your bad upload? when you view your twitch dashboard have you checked what your stream quality is per twitch? cause if it's of poor quality they won't even stream it i believe.

keyframe in script with

-g 2 -keyint_min 2

on dashboard i am still average, i mean acceptable

Maarten Baert

Administrator

Comment #71: Thu, 23 Jan 2014, 0:12 (GMT+1, DST)

Quote


Quote: Nismo

keyframe in script with

-g 2 -keyint_min 2

on dashboard i am still average, i mean acceptable

The keyframe interval should be 2 seconds, not 2 frames. For 30 fps, use -g 60 (you don't need keyint_min AFAIK). Read this comment for more info.

Last modified: Thu, 23 Jan 2014, 0:12 (GMT+1, DST)

Ubuntuaddicted

Comment #72: Tue, 28 Jan 2014, 18:43 (GMT+1, DST)

Quote


Maartin, does ssr support any of the other aac encoders that are out there like libfdk_aac or libfaac if I were to compile and install my own ffmpeg?

Maarten Baert

Administrator

Comment #73: Wed, 29 Jan 2014, 4:26 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

Maartin, does ssr support any of the other aac encoders that are out there like libfdk_aac or libfaac if I were to compile and install my own ffmpeg?

You should be able to use any encoder that ffmpeg supports. SSR defaults to 'libvo_aacenc' if it exists, and 'aac' otherwise. The 'aac' encoder used to be terrible, but it has improved in recent versions of ffmpeg. I have never tested libfdk_aac.

Bucaneer

Comment #74: Tue, 4 Feb 2014, 19:07 (GMT+1, DST)

Quote


Regarding ffserver, recent versions of ffmpeg have the option to override the stream settings that are provided by ffserver. With it enabled, ffserver simply broadcasts whatever is provided by ffmpeg. The patch is dated 2013-07-08, so presumably it's been available in ffmpeg releases since version 2.0.

Ubuntuaddicted

Comment #75: Thu, 6 Feb 2014, 16:27 (GMT+1, DST)

Quote


Quote: Bucaneer

Regarding ffserver, recent versions of ffmpeg have the option to override the stream settings that are provided by ffserver. With it enabled, ffserver simply broadcasts whatever is provided by ffmpeg. The patch is dated 2013-07-08, so presumably it's been available in ffmpeg releases since version 2.0.

i am curious what the point would be to use ffserver or avserver? I am new to streaming so trying to learn about the various way to accomplish it. I normally stream to hitbox.tv since they have a nice chat system setup, also a way for people to follow me and receive an email when i go live etc etc. Also the ability to play ads. Why would i want to send my stream from ssr to ffserver for ffserver only to send it to hitbox. Isn't that an unneccessary layer?

Bucaneer

Comment #76: Fri, 7 Feb 2014, 11:50 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

i am curious what the point would be to use ffserver or avserver? I am new to streaming so trying to learn about the various way to accomplish it. I normally stream to hitbox.tv since they have a nice chat system setup, also a way for people to follow me and receive an email when i go live etc etc. Also the ability to play ads. Why would i want to send my stream from ssr to ffserver for ffserver only to send it to hitbox. Isn't that an unneccessary layer?

You're right, it's not useful if you intend to broadcast through some other third-party service anyway. Ffserver is for cases where you don't want to use third party intermediaries, e.g. if you want to stream something to several destinations in a local network, or if you only want to stream to few enough clients that your own internet connection can handle sending video directly to all of them, or if you want to create a broadcast setup on your own servers, etc.

Maarten Baert

Administrator

Comment #77: Tue, 11 Feb 2014, 20:40 (GMT+1, DST)

Quote


Quote: Bucaneer

You're right, it's not useful if you intend to broadcast through some other third-party service anyway. Ffserver is for cases where you don't want to use third party intermediaries, e.g. if you want to stream something to several destinations in a local network, or if you only want to stream to few enough clients that your own internet connection can handle sending video directly to all of them, or if you want to create a broadcast setup on your own servers, etc.

Correct. But I could never get it to work properly with SSR. Since nginx+rtmp works fine and is simpler to set up and use, I used that instead.

Keep in mind that libav does not merge from ffmpeg, so a patch for ffmpeg is not necessarily available in libav. Also, the version used in Ubuntu 12.04 up to 13.10 is now 2 years old.

Djl197

Comment #78: Mon, 17 Feb 2014, 11:18 (GMT+1, DST)

Quote


I am trying to do udp streaming but have 2 ethernet devices (eth0 and eth1).
Eth0 is my control network and eth1 is my data connection on which i want to stream the video data.
Is there a way I can get it to stream over eth1 instead of eth0?

Cheers
Dan

Ubuntuaddicted

Comment #79: Mon, 17 Feb 2014, 19:27 (GMT+1, DST)

Quote


Quote: Djl197

I am trying to do udp streaming but have 2 ethernet devices (eth0 and eth1).
Eth0 is my control network and eth1 is my data connection on which i want to stream the video data.
Is there a way I can get it to stream over eth1 instead of eth0?

Cheers
Dan

this has nothing to do with ssr. you have to have your networking setup correctly. IF eth2 is what's suppose to be used for outgoint packets than i believe you would set that up with your routing table.

Soulhuntor

Comment #80: Sun, 2 Mar 2014, 10:51 (GMT+1, DST)

Quote


Streaming to Twitch.tv is eating up my RAM. Any solutions?

Maarten Baert

Administrator

Comment #81: Sun, 2 Mar 2014, 14:30 (GMT+1, DST)

Quote


Quote: Soulhuntor

Streaming to Twitch.tv is eating up my RAM. Any solutions?

RAM usage anywhere between 200MB and 400MB is normal (depends on the video resolution). How much RAM do you have? Also, when you notice high RAM usage, what is the 'FPS in' and 'FPS out' in SSR?

Last modified: Sun, 2 Mar 2014, 14:33 (GMT+1, DST)

Soulhuntor1

Comment #82: Sun, 2 Mar 2014, 19:49 (GMT+1, DST)

Quote


I have 8GB of RAM. SSR kept getting to 5GB before my computer started to freeze. 30fps in and out. Here is a recording of the stream with part of SSR and Ksysmonitor showing http://www.twitch.tv/thedaftrick/b/507625619 Also the CPU usage seemed a bit high at 45%

Maarten Baert

Administrator

Comment #83: Mon, 3 Mar 2014, 1:33 (GMT+1, DST)

Quote


Quote: Soulhuntor1

I have 8GB of RAM. SSR kept getting to 5GB before my computer started to freeze. 30fps in and out. Here is a recording of the stream with part of SSR and Ksysmonitor showing http://www.twitch.tv/thedaftrick/b/507625619 Also the CPU usage seemed a bit high at 45%

That's obviously not normal. The FPS is okay which indicates that SSR is not throttling, and the video itself plays fine so the encoders were still working properly. Can you send me the full log file? It's saved in ~/.ssr.

Last modified: Mon, 3 Mar 2014, 1:33 (GMT+1, DST)

Soulhuntor1

Comment #84: Mon, 3 Mar 2014, 2:05 (GMT+1, DST)

Quote


This one got up to 2GB before I stopped it. I just stood in one spot in the game doing nothing and the memory seemed fine, but once I started running around the memory usage started climbing

http://pastebin.com/p2GYHxrk

Last modified: Mon, 3 Mar 2014, 2:05 (GMT+1, DST)

Maarten Baert

Administrator

Comment #85: Mon, 3 Mar 2014, 2:28 (GMT+1, DST)

Quote


Quote: Soulhuntor1

This one got up to 2GB before I stopped it. I just stood in one spot in the game doing nothing and the memory seemed fine, but once I started running around the memory usage started climbing

http://pastebin.com/p2GYHxrk

Thanks, but it seems I won't be needing your log, I already managed to reproduce the bug myself. It turns out that there's a subtle bug in the synchronizer that causes it not to throttle at all as long as there are still enough frames in the queue. I've fixed it now and I will release a new version.

After the fix, the memory usage of SSR stopped increasing at around 800MB (for 1080p video with preset=medium). About 600MB of that seems to be internal memory of the video encoder so I can't decrease it much further.

For now, you should use a faster preset (preset=fast or preset=faster), so that SSR won't have to throttle your frame rate.

Last modified: Mon, 3 Mar 2014, 2:29 (GMT+1, DST)

Soulhuntor1

Comment #86: Mon, 3 Mar 2014, 4:14 (GMT+1, DST)

Quote


Awesome, thank you! SSR is wonderful thanks for your hard work.

Bartek24m

Comment #87: Mon, 3 Mar 2014, 16:53 (GMT+1, DST)

Quote


I installed nginx rtmp video streaming

this is my configuration file:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
    worker_connections 768;
    multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    # keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}



rtmp {
    server {
        listen 10200;
    wait_key on;
    wait_video on;
        
    application live {
            live on;
        
        # record first 100M of stream
            record all;
            record_path /var/mojStream/audycje;
            record_max_size 100M;
    record_unique off;
    allow play all;
 
        }
    }
}

My problem is:
when someone refersh page with player during watching streaming, video don't play again,
viewer see only buffering

try it yourself, I accually streaming video:
http://176.31.241.202:757/

when you see the video please refresh the page, and try to play video again

Last modified: Mon, 3 Mar 2014, 16:59 (GMT+1, DST)

Maarten Baert

Administrator

Comment #88: Mon, 3 Mar 2014, 17:38 (GMT+1, DST)

Quote


Quote: Bartek24m

My problem is:
when someone refersh page with player during watching streaming, video don't play again,
viewer see only buffering

try it yourself, I accually streaming video:
http://176.31.241.202:757/

when you see the video please refresh the page, and try to play video again

I can't see the video, not even the first time. It also doesn't work in VLC. Are you sure that the stream is still active?

Bartek24m

Comment #89: Mon, 3 Mar 2014, 18:22 (GMT+1, DST)

Quote


i try to stream again about 12 PM

Last modified: Mon, 3 Mar 2014, 18:30 (GMT+1, DST)

Maarten Baert

Administrator

Comment #90: Mon, 3 Mar 2014, 19:51 (GMT+1, DST)

Quote


Quote: Bartek24m

i try to stream again about 12 PM

Which time zone are you in?

Last modified: Mon, 3 Mar 2014, 19:51 (GMT+1, DST)

Bartek24m

Comment #91: Tue, 4 Mar 2014, 1:00 (GMT+1, DST)

Quote


GMT+1, DST

about which time i can try ?

Maarten Baert

Administrator

Comment #92: Tue, 4 Mar 2014, 19:54 (GMT+1, DST)

Quote


Quote: Bartek24m

GMT+1, DST

about which time i can try ?

I don't think it will help if I watch your stream, I still can't debug it just by watching. I would need to reproduce it on my own computer, and I haven't been able to do that.

Can you try watching your own stream with VLC, or Flowplayer? I want to make sure that it's not a bug in the video player. You should also take a look at the nginx logs, there may be useful information in there.

Bartek24m

Comment #93: Wed, 5 Mar 2014, 0:06 (GMT+1, DST)

Quote


yes i try in another player
the problem is in all players

try watch now, i streaming.

I notice that after i stop streaming and disconnect and connect again and start streaming.
I can refresh and it's starts play.

So mabe it's something wrong with Adobe Flash Media Encoder Live 3.2 ?
Could you suggest me another soft to stream video ?

213.155.191.77 - - [05/Mar/2014:00:03:09 +0100] "GET / HTTP/1.1" 200 381 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
213.155.191.77 [05/Mar/2014:00:05:26 +0100] PUBLISH "live" "stream" "videoKeyframeFrequency=5&totalDatarate=248" - 1223648432 4451 "" "FMLE/3.0 (compatible; FMSc/1.0)" (11h 22m 33s)
213.155.191.77 - - [05/Mar/2014:00:17:30 +0100] "GET / HTTP/1.1" 200 381 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
213.155.191.77 [05/Mar/2014:00:17:28 +0100] PLAY "live" "stream" "" - 580 21639178 "http://176.31.241.202:757/" "WIN 12,0,0,70" (14m 18s)
213.155.191.77 - - [05/Mar/2014:00:17:43 +0100] "GET / HTTP/1.1" 200 381 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
213.155.191.77 [05/Mar/2014:00:17:44 +0100] PLAY "live" "stream" "" - 571 547 "http://176.31.241.202:757/" "WIN 12,0,0,70" (12s)
213.155.191.77 - - [05/Mar/2014:00:17:46 +0100] "GET / HTTP/1.1" 200 381 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
213.155.191.77 [05/Mar/2014:00:17:46 +0100] NONE "live" "" "" - 458 292 "http://176.31.241.202:757/" "WIN 12,0,0,70" (1s)

accually i stream till 2 PM +1GTM if you read this later
you can stream yourself on nginx there is no firewall and give it a try

FMS URL: rtmp://176.31.241.202:10200/live

Stream: stream

Last modified: Wed, 5 Mar 2014, 1:33 (GMT+1, DST)

Maarten Baert

Administrator

Comment #94: Wed, 5 Mar 2014, 17:05 (GMT+1, DST)

Quote


Quote: Bartek24m

accually i stream till 2 PM +1GTM if you read this later
you can stream yourself on nginx there is no firewall and give it a try

I tried it, and I got exactly the same issue. The weird thing is that this doesn't happen with my own nginx server. So I suspect it's a configuration problem. Could you please try to copy the configuration from this article exactly, and try it again? If that doesn't work, can you make sure that you are using the latest version of the nginx RTMP module (from github)?

Davidystephenson

Comment #95: Mon, 10 Mar 2014, 0:18 (GMT+1, DST)

Quote


I'm trying to record Dota 2 to Twitch. However, when I attempt to do so, I do not get flv as a container option or libx264 as a codec option. I'm using Ubuntu 13.10. I've installed all the codecs I can find that seem related, including:

qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386 libavcodec-extra-53 libavformat-extra-53.

Despite all this, I still do not receive the necessary options. When I attempt to stream, Twitch just says my stream is offline. Do you have any advice?

Maarten Baert

Administrator

Comment #96: Tue, 11 Mar 2014, 0:51 (GMT+1, DST)

Quote


Quote: Davidystephenson

I'm trying to record Dota 2 to Twitch. However, when I attempt to do so, I do not get flv as a container option or libx264 as a codec option. I'm using Ubuntu 13.10. I've installed all the codecs I can find that seem related, including:

qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386 libavcodec-extra-53 libavformat-extra-53.

Despite all this, I still do not receive the necessary options. When I attempt to stream, Twitch just says my stream is offline. Do you have any advice?

The flv and libx264 options are found under 'Other'. If they are still not there, please upload the output of the commands avconv -codecs and avconv -formats (please use http://pastebin.com).

Davidystephenson

Comment #97: Tue, 11 Mar 2014, 2:19 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Davidystephenson

I'm trying to record Dota 2 to Twitch. However, when I attempt to do so, I do not get flv as a container option or libx264 as a codec option. I'm using Ubuntu 13.10. I've installed all the codecs I can find that seem related, including:

qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386 libavcodec-extra-53 libavformat-extra-53.

Despite all this, I still do not receive the necessary options. When I attempt to stream, Twitch just says my stream is offline. Do you have any advice?

The flv and libx264 options are found under 'Other'. If they are still not there, please upload the output of the commands avconv -codecs and avconv -formats (please use http://pastebin.com).

I did check in the Other options. Flv is available as a codec but not a container. libx264 is as a codec, but I cannot use both flx and libx264 a the same time. The outputs of both commands is here: http://pastebin.com/RAcTHvXV

Last modified: Thu, 13 Mar 2014, 4:31 (GMT+1, DST)

Ubuntuaddicted

Comment #98: Thu, 13 Mar 2014, 8:34 (GMT+1, DST)

Quote


Quote: Davidystephenson
Quote: Maarten Baert
Quote: Davidystephenson

I'm trying to record Dota 2 to Twitch. However, when I attempt to do so, I do not get flv as a container option or libx264 as a codec option. I'm using Ubuntu 13.10. I've installed all the codecs I can find that seem related, including:

qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386 libavcodec-extra-53 libavformat-extra-53.

Despite all this, I still do not receive the necessary options. When I attempt to stream, Twitch just says my stream is offline. Do you have any advice?

The flv and libx264 options are found under 'Other'. If they are still not there, please upload the output of the commands avconv -codecs and avconv -formats (please use http://pastebin.com).

I did check in the Other options. Flv is available as a codec but not a container. libx264 is as a codec, but I cannot use both flx and libx264 a the same time. The outputs of both commands is here: http://pastebin.com/RAcTHvXV

here's what ssr looks like when streaming to twitch

Image: ssr.png

Last modified: Thu, 13 Mar 2014, 8:35 (GMT+1, DST)

Davidystephenson

Comment #99: Thu, 13 Mar 2014, 15:31 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Davidystephenson
Quote: Maarten Baert
Quote: Davidystephenson

I'm trying to record Dota 2 to Twitch. However, when I attempt to do so, I do not get flv as a container option or libx264 as a codec option. I'm using Ubuntu 13.10. I've installed all the codecs I can find that seem related, including:

qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386 libavcodec-extra-53 libavformat-extra-53.

Despite all this, I still do not receive the necessary options. When I attempt to stream, Twitch just says my stream is offline. Do you have any advice?

The flv and libx264 options are found under 'Other'. If they are still not there, please upload the output of the commands avconv -codecs and avconv -formats (please use http://pastebin.com).

I did check in the Other options. Flv is available as a codec but not a container. libx264 is as a codec, but I cannot use both flx and libx264 a the same time. The outputs of both commands is here: http://pastebin.com/RAcTHvXV

here's what ssr looks like when streaming to twitch

Image: ssr.png

I'm aware that is what it should look like; again, the problem is that flv does not show up as a container option.

Maarten Baert

Administrator

Comment #100: Fri, 14 Mar 2014, 19:48 (GMT+1, DST)

Quote


Quote: Davidystephenson

I'm aware that is what it should look like; again, the problem is that flv does not show up as a container option.

I have an Ubuntu 13.10 VM and the flv container is there. Are you sure that you don't have it? Run avconv -formats to find out.

Ubuntuaddicted

Comment #101: Sat, 15 Mar 2014, 15:42 (GMT+1, DST)

Quote


Quote: Davidystephenson
Quote: Ubuntuaddicted
Quote: Davidystephenson
Quote: Maarten Baert
Quote: Davidystephenson

I'm trying to record Dota 2 to Twitch. However, when I attempt to do so, I do not get flv as a container option or libx264 as a codec option. I'm using Ubuntu 13.10. I've installed all the codecs I can find that seem related, including:

qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib libxext6:i386 libglu1-mesa:i386 libxfixes3:i386 libavcodec-extra-53 libavformat-extra-53.

Despite all this, I still do not receive the necessary options. When I attempt to stream, Twitch just says my stream is offline. Do you have any advice?

The flv and libx264 options are found under 'Other'. If they are still not there, please upload the output of the commands avconv -codecs and avconv -formats (please use http://pastebin.com).

I did check in the Other options. Flv is available as a codec but not a container. libx264 is as a codec, but I cannot use both flx and libx264 a the same time. The outputs of both commands is here: http://pastebin.com/RAcTHvXV

here's what ssr looks like when streaming to twitch

Image: ssr.png

I'm aware that is what it should look like; again, the problem is that flv does not show up as a container option.

I'm running xubuntu 13.10 and flv is there as a container option. You have to first change container to "other" and then the list of containers appears

Ubuntuaddicted

Comment #102: Sat, 15 Mar 2014, 15:44 (GMT+1, DST)

Quote


I'm running a compiled version of your software from the glinject-next branch, compiled months ago. It says it's version SimpleScreenRecorder 0.1.2. How can i tell if there's been improvements to the glinject-next branch and that I need to compile again? I am only using the glinject-next branch so I can use the keyinit 60 option. Any info would be much appreciateed.

Davidystephenson

Comment #103: Sun, 16 Mar 2014, 0:14 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Davidystephenson

I'm aware that is what it should look like; again, the problem is that flv does not show up as a container option.

I have an Ubuntu 13.10 VM and the flv container is there. Are you sure that you don't have it? Run avconv -formats to find out.

Apparently I needed to install a variety of updates including one to SSR. After a restart, things were good! Thanks for your help.

Maarten Baert

Administrator

Comment #104: Mon, 17 Mar 2014, 4:21 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

I'm running a compiled version of your software from the glinject-next branch, compiled months ago. It says it's version SimpleScreenRecorder 0.1.2. How can i tell if there's been improvements to the glinject-next branch and that I need to compile again? I am only using the glinject-next branch so I can use the keyinit 60 option. Any info would be much appreciateed.

Yes, there have been many improvements. Just run 'git pull' to get the latest changes, and run simple-build-and-install again.

Davidystephenson

Comment #105: Mon, 17 Mar 2014, 14:03 (GMT+1, DST)

Quote


I am experiencing very strange behavior when live streaming. When recording to desktop, the audio is perfect. I use the 'hard' method you describe (http://www.maartenbaert.be/simplescreenrecorder/recording-game-audio/#the-hard-way) to pick up both my mic and game audio. When I live stream, my microphone and game audio both repeat multiple times. Again, when recording locally, both audio sources work correctly, but when live streaming, microphone and game audio is repeated multiple times. I'd be happy to provide samples or screenshots wherever they would useful.

Last modified: Mon, 17 Mar 2014, 14:28 (GMT+1, DST)

Maarten Baert

Administrator

Comment #106: Tue, 18 Mar 2014, 1:56 (GMT+1, DST)

Quote


Quote: Davidystephenson

I am experiencing very strange behavior when live streaming. When recording to desktop, the audio is perfect. I use the 'hard' method you describe (http://www.maartenbaert.be/simplescreenrecorder/recording-game-audio/#the-hard-way) to pick up both my mic and game audio. When I live stream, my microphone and game audio both repeat multiple times. Again, when recording locally, both audio sources work correctly, but when live streaming, microphone and game audio is repeated multiple times. I'd be happy to provide samples or screenshots wherever they would useful.

Before I try to reproduce this, can you make sure that you don't have any Twitch tabs open that are playing back your audio and causing it to be re-recorded? That would be the most obvious reason :).

Ubuntuaddicted

Comment #107: Thu, 20 Mar 2014, 3:47 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Davidystephenson

I am experiencing very strange behavior when live streaming. When recording to desktop, the audio is perfect. I use the 'hard' method you describe (http://www.maartenbaert.be/simplescreenrecorder/recording-game-audio/#the-hard-way) to pick up both my mic and game audio. When I live stream, my microphone and game audio both repeat multiple times. Again, when recording locally, both audio sources work correctly, but when live streaming, microphone and game audio is repeated multiple times. I'd be happy to provide samples or screenshots wherever they would useful.

Before I try to reproduce this, can you make sure that you don't have any Twitch tabs open that are playing back your audio and causing it to be re-recorded? That would be the most obvious reason :).

i was just going to post this as well, if you have the stream open of course you'll get echo and repeating. if you must have the stream open in a web browser, you need to mute it OR even open pavucontrol and look for the browser entry within the playback tab and mute that so the browser audio is muted

Davidystephenson

Comment #108: Thu, 20 Mar 2014, 21:06 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted
Quote: Maarten Baert
Quote: Davidystephenson

I am experiencing very strange behavior when live streaming. When recording to desktop, the audio is perfect. I use the 'hard' method you describe (http://www.maartenbaert.be/simplescreenrecorder/recording-game-audio/#the-hard-way) to pick up both my mic and game audio. When I live stream, my microphone and game audio both repeat multiple times. Again, when recording locally, both audio sources work correctly, but when live streaming, microphone and game audio is repeated multiple times. I'd be happy to provide samples or screenshots wherever they would useful.

Before I try to reproduce this, can you make sure that you don't have any Twitch tabs open that are playing back your audio and causing it to be re-recorded? That would be the most obvious reason :).

i was just going to post this as well, if you have the stream open of course you'll get echo and repeating. if you must have the stream open in a web browser, you need to mute it OR even open pavucontrol and look for the browser entry within the playback tab and mute that so the browser audio is muted

Apparently I had switched an option around in Pavucontrol, everything works fine now. I do have one more question; I stream e-sports tournaments, and they often require that I have a delay on my stream of 2 minutes. Is there any way or option to add a streaming delay?

Last modified: Thu, 20 Mar 2014, 21:09 (GMT+1, DST)

Maarten Baert

Administrator

Comment #109: Sun, 23 Mar 2014, 0:07 (GMT+1, DST)

Quote


Quote: Davidystephenson

Apparently I had switched an option around in Pavucontrol, everything works fine now. I do have one more question; I stream e-sports tournaments, and they often require that I have a delay on my stream of 2 minutes. Is there any way or option to add a streaming delay?

Services like Twitch have an option for this on their servers:
http://help.twitch.tv/customer/portal/articles/1126395-how-stream-delay-works

It's hard to add something like this to SSR in its current form. I can't store 2 minutes of uncompressed video because there's just not enough RAM. But the encoding and streaming is handled by ffmpeg and it doesn't seem to have an option to add a delay. Once I send video to ffmpeg, it gets streamed. I also can't delay the RTMP stream itself because RTMP is a two-way protocol.

I could try to delay packets when I send them from the encoder to the muxer - the packets are already compressed so the size isn't too big, but it sounds like a pretty ugly hack. But it's pretty easy to do. I think I will give it a try.

Last modified: Sun, 23 Mar 2014, 0:07 (GMT+1, DST)

Davidystephenson

Comment #110: Mon, 24 Mar 2014, 0:33 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Davidystephenson

Apparently I had switched an option around in Pavucontrol, everything works fine now. I do have one more question; I stream e-sports tournaments, and they often require that I have a delay on my stream of 2 minutes. Is there any way or option to add a streaming delay?

Services like Twitch have an option for this on their servers:
http://help.twitch.tv/customer/portal/articles/1126395-how-stream-delay-works

It's hard to add something like this to SSR in its current form. I can't store 2 minutes of uncompressed video because there's just not enough RAM. But the encoding and streaming is handled by ffmpeg and it doesn't seem to have an option to add a delay. Once I send video to ffmpeg, it gets streamed. I also can't delay the RTMP stream itself because RTMP is a two-way protocol.

I could try to delay packets when I send them from the encoder to the muxer - the packets are already compressed so the size isn't too big, but it sounds like a pretty ugly hack. But it's pretty easy to do. I think I will give it a try.

Twitch apparently will only activate this feature for designated partners. If such a feature could be added, that would be excellent.

Maarten Baert

Administrator

Comment #111: Mon, 24 Mar 2014, 3:22 (GMT+1, DST)

Quote


Quote: Davidystephenson

Twitch apparently will only activate this feature for designated partners. If such a feature could be added, that would be excellent.

I'm looking into it. It's slightly harder than I originally thought, because I suspect that Twitch will close the connection if I connect to their servers and then just wait for two minutes without streaming anything at all. Unfortunately ffmpeg doesn't have a way to start the encoders before I open the file, so I will have to write my own output system. I think this is possible and it's something that I wanted to do anyway for other reasons, so it's not a huge problem.

Ubuntuaddicted

Comment #112: Thu, 27 Mar 2014, 1:30 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Ubuntuaddicted

I'm running a compiled version of your software from the glinject-next branch, compiled months ago. It says it's version SimpleScreenRecorder 0.1.2. How can i tell if there's been improvements to the glinject-next branch and that I need to compile again? I am only using the glinject-next branch so I can use the keyinit 60 option. Any info would be much appreciateed.

Yes, there have been many improvements. Just run 'git pull' to get the latest changes, and run simple-build-and-install again.

not sure if i did this correctly. i was running a compiled version from your glinject-next branch for the longest time. i wanted to download and run the latest code so I ran git pull and then ran the simple-build-install script. It appeared to have worked except now when I look into the opengl recording there are many things that are missing that were there toward the bottom of this screenshot
http://gyazo.com/38e775f6a6abec0a6613db36b4ff2f2a
there used to be like 4 different lines along the bottom with white boxes to fill stuff in there, i never used them but they were there. How can I tell if I updated my glinject-next branch code and compiled that versus just pulling your main branch and compiling that? Sorry for the confusion.

Maarten Baert

Administrator

Comment #113: Sat, 29 Mar 2014, 14:42 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

not sure if i did this correctly. i was running a compiled version from your glinject-next branch for the longest time. i wanted to download and run the latest code so I ran git pull and then ran the simple-build-install script. It appeared to have worked except now when I look into the opengl recording there are many things that are missing that were there toward the bottom of this screenshot
http://gyazo.com/38e775f6a6abec0a6613db36b4ff2f2a
there used to be like 4 different lines along the bottom with white boxes to fill stuff in there, i never used them but they were there. How can I tell if I updated my glinject-next branch code and compiled that versus just pulling your main branch and compiling that? Sorry for the confusion.

That's normal. I removed those in favor of the new 'channel' system which is a lot more reliable.

Jbrouhard

Comment #114: Sun, 30 Mar 2014, 0:24 (GMT+1, DST)

Quote


Are there any plans to allow someone to put images in front of the desktop, like overlays ?

Maarten Baert

Administrator

Comment #115: Sun, 30 Mar 2014, 0:51 (GMT+1, DST)

Quote


Quote: Jbrouhard

Are there any plans to allow someone to put images in front of the desktop, like overlays ?

Yes, but this requires some major changes to the backend. It won't be ready anytime soon.

Last modified: Sun, 30 Mar 2014, 0:51 (GMT+1, DST)

Falkorn

Comment #116: Fri, 11 Apr 2014, 18:54 (GMT+1, DST)

Quote


Hello Maarten, your SSR is awesome! It's work well. But i have a question. How can i stream on twitch with "stereo mix"? Thats mean i want to stream sounds from my game, my voice and voices of my mates in skype. I tried to play with Monitor of Build-in Audio analog stereo and other things in this menu. But it seems like "in my stream all hears only my voice from my mic" or "all hear voices of my mates and sound from my game". Can it be together?
Sorry for my english.

Ubuntuaddicted

Comment #117: Fri, 11 Apr 2014, 20:30 (GMT+1, DST)

Quote


Quote: Falkorn

Hello Maarten, your SSR is awesome! It's work well. But i have a question. How can i stream on twitch with "stereo mix"? Thats mean i want to stream sounds from my game, my voice and voices of my mates in skype. I tried to play with Monitor of Build-in Audio analog stereo and other things in this menu. But it seems like "in my stream all hears only my voice from my mic" or "all hear voices of my mates and sound from my game". Can it be together?
Sorry for my english.

you need to follow his guide for recording both game audio and mic audio. here's the link, http://www.maartenbaert.be/simplescreenrecorder/recording-game-audio/
follow either the easy or hard way.

I currently stream myself playing games and it records the game audio, my audio and my friends audio from either teamspeak or skype

Last modified: Sat, 12 Apr 2014, 19:08 (GMT+1, DST)

Nachtwind

Comment #118: Mon, 28 Apr 2014, 19:47 (GMT+1, DST)

Quote


I have a question regarding streaming to twitch.tv.
I followed your guide here but i keep getting the same "error". Although i can directly grab my stream from twitch using vlc and some scripting i cant see it on the browser - or any other user.
The player stays black and is stuck on "loading" - yet it shows that i am LIVE...
Some people mentioned to me that the reason might be a video stream that is incompatible with their plugin.. therefore i would like to be on the safe side and wonder if there are any settings that i need to change here in order to make it work. So my settings are as following:

Save as: rtmp://etc
Container: Other
Container name: flv

Codec Other
Codec name: lobx264
Bit rate 3000
Custom options: preset=veryfast,minrate=3000,maxrate=3000,bufsize=3000,keyint=60
[x] Allow frame skipping
Audiocodec: AAC
Bit rate: 128

So.. has anyone any idea?

Maarten Baert

Administrator

Comment #119: Tue, 29 Apr 2014, 3:30 (GMT+1, DST)

Quote


Quote: Nachtwind

I have a question regarding streaming to twitch.tv.
I followed your guide here but i keep getting the same "error". Although i can directly grab my stream from twitch using vlc and some scripting i cant see it on the browser - or any other user.
The player stays black and is stuck on "loading" - yet it shows that i am LIVE...
Some people mentioned to me that the reason might be a video stream that is incompatible with their plugin.. therefore i would like to be on the safe side and wonder if there are any settings that i need to change here in order to make it work. So my settings are as following:

Save as: rtmp://etc
Container: Other
Container name: flv

Codec Other
Codec name: lobx264
Bit rate 3000
Custom options: preset=veryfast,minrate=3000,maxrate=3000,bufsize=3000,keyint=60
[x] Allow frame skipping
Audiocodec: AAC
Bit rate: 128

So.. has anyone any idea?

I have seen this problem before, but it only seems to happen on Ubuntu which makes this a bit hard to debug. I suspect it's a problem with Libav that doesn't appear in FFmpeg. You could try to use MP3 instead of AAC but I doubt that will make any difference. I will try to look into this at some point, but I don't have much time at the moment.

Which Linux distribution are you using?

Ubuntuaddicted

Comment #120: Tue, 29 Apr 2014, 22:24 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Nachtwind

I have a question regarding streaming to twitch.tv.
I followed your guide here but i keep getting the same "error". Although i can directly grab my stream from twitch using vlc and some scripting i cant see it on the browser - or any other user.
The player stays black and is stuck on "loading" - yet it shows that i am LIVE...
Some people mentioned to me that the reason might be a video stream that is incompatible with their plugin.. therefore i would like to be on the safe side and wonder if there are any settings that i need to change here in order to make it work. So my settings are as following:

Save as: rtmp://etc
Container: Other
Container name: flv

Codec Other
Codec name: lobx264
Bit rate 3000
Custom options: preset=veryfast,minrate=3000,maxrate=3000,bufsize=3000,keyint=60
[x] Allow frame skipping
Audiocodec: AAC
Bit rate: 128

So.. has anyone any idea?

I have seen this problem before, but it only seems to happen on Ubuntu which makes this a bit hard to debug. I suspect it's a problem with Libav that doesn't appear in FFmpeg. You could try to use MP3 instead of AAC but I doubt that will make any difference. I will try to look into this at some point, but I don't have much time at the moment.

Which Linux distribution are you using?

the black screen happens when your keyframe interval isn't correctly set but it appears that yours is set. see if you can stream to hitbox so we can rule out it being a problem on twitch's end.

Maarten Baert

Administrator

Comment #121: Wed, 30 Apr 2014, 19:28 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

the black screen happens when your keyframe interval isn't correctly set but it appears that yours is set. see if you can stream to hitbox so we can rule out it being a problem on twitch's end.

It is almost certainly an issue with the Twitch player since it does work in VLC. But that doesn't really solve the problem, it's unlikely that Twitch is going to change its player ...

Ubuntuaddicted

Comment #122: Thu, 1 May 2014, 17:19 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Ubuntuaddicted

the black screen happens when your keyframe interval isn't correctly set but it appears that yours is set. see if you can stream to hitbox so we can rule out it being a problem on twitch's end.

It is almost certainly an issue with the Twitch player since it does work in VLC. But that doesn't really solve the problem, it's unlikely that Twitch is going to change its player ...

if we determine whether it's twitch or on his end by trying it on hitbox, we can find out if submitting a ticket to twitch is warrented.

Davidystephenson

Comment #123: Fri, 20 Jun 2014, 4:38 (GMT+1, DST)

Quote


Hey Maarten, I had asked earlier about adding delays to live streams. You said it would be possible and could be coming out soon. Has there been any progress on this?

Maarten Baert

Administrator

Comment #124: Fri, 20 Jun 2014, 14:18 (GMT+1, DST)

Quote


Quote: Davidystephenson

Hey Maarten, I had asked earlier about adding delays to live streams. You said it would be possible and could be coming out soon. Has there been any progress on this?

What I originally planned to do turned out to be impossible. The problem is that Twitch doesn't like it when I create a connection to them and then don't stream anything during the first two minutes. Unfortunately ffmpeg doesn't allow me to start encoding before opening that connection. And I can't keep two minutes of un-encoded video in memory because it is just too big.

I will have to add 'native' RTMP support (through librtmp) instead of relying on ffmpeg to do it for me. That will give me the ability to do things like delayed streaming, and saving a copy of the stream to disk (among other things). Unfortunately this is a lot harder so it will take more time.

Davidystephenson

Comment #125: Fri, 20 Jun 2014, 22:53 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Davidystephenson

Hey Maarten, I had asked earlier about adding delays to live streams. You said it would be possible and could be coming out soon. Has there been any progress on this?

What I originally planned to do turned out to be impossible. The problem is that Twitch doesn't like it when I create a connection to them and then don't stream anything during the first two minutes. Unfortunately ffmpeg doesn't allow me to start encoding before opening that connection. And I can't keep two minutes of un-encoded video in memory because it is just too big.

I will have to add 'native' RTMP support (through librtmp) instead of relying on ffmpeg to do it for me. That will give me the ability to do things like delayed streaming, and saving a copy of the stream to disk (among other things). Unfortunately this is a lot harder so it will take more time.

I see. Thank you for the update.

Prospectbil

Comment #126: Sat, 5 Jul 2014, 17:43 (GMT+1, DST)

Quote


I'm getting stuck on "loading video" on twitch. Running Ubuntu 12.04. I never had a problem before the new update. My sessions are being recorded but the live stream won't load. I've read a few comments and is this really only a problem with Ubuntu?

Maarten Baert

Administrator

Comment #127: Sun, 6 Jul 2014, 17:37 (GMT+1, DST)

Quote


Quote: Prospectbil

I'm getting stuck on "loading video" on twitch. Running Ubuntu 12.04. I never had a problem before the new update. My sessions are being recorded but the live stream won't load. I've read a few comments and is this really only a problem with Ubuntu?

I've never seen it happen on anything other than Ubuntu, but that doesn't mean it's necessarily tied to Ubuntu. Are you using exactly the same settings as you did before?

Prospectbil

Comment #128: Thu, 10 Jul 2014, 23:25 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Prospectbil

I'm getting stuck on "loading video" on twitch. Running Ubuntu 12.04. I never had a problem before the new update. My sessions are being recorded but the live stream won't load. I've read a few comments and is this really only a problem with Ubuntu?

I've never seen it happen on anything other than Ubuntu, but that doesn't mean it's necessarily tied to Ubuntu. Are you using exactly the same settings as you did before?

Yes and I also tried it with the streaming profiles provided in the new version.

Maarten Baert

Administrator

Comment #129: Fri, 11 Jul 2014, 0:10 (GMT+1, DST)

Quote


Quote: Prospectbil

Yes and I also tried it with the streaming profiles provided in the new version.

In that case there's not much I can do, for some reason I haven't been able to reproduce it myself. Have you tried it with Ubuntu 14.04? It has a more recent version of libav.

Last modified: Fri, 11 Jul 2014, 0:10 (GMT+1, DST)

Prospectbil

Comment #130: Fri, 11 Jul 2014, 15:15 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Prospectbil

Yes and I also tried it with the streaming profiles provided in the new version.

In that case there's not much I can do, for some reason I haven't been able to reproduce it myself. Have you tried it with Ubuntu 14.04? It has a more recent version of libav.

That's my next step. Only reason I haven't gotten 14.04 is because I don't have a storage device to back up my pc yet, but I'll do that this weekend.

Red1432

Comment #131: Mon, 11 Aug 2014, 21:37 (GMT+1, DST)

Quote


So I have everything put in, but does the rtmp need to be where you live? like, i live right by the state im using the rtmp for, and also, when i stream on twitch, it just says live and loading, and you cant see the video. Any help?

Ubuntuaddicted

Comment #132: Tue, 12 Aug 2014, 16:43 (GMT+1, DST)

Quote


Quote: Red1432

So I have everything put in, but does the rtmp need to be where you live? like, i live right by the state im using the rtmp for, and also, when i stream on twitch, it just says live and loading, and you cant see the video. Any help?

no, the rtmp server can be anywhere theoretically. if you enable the preview window does it show video? i've experienced that twitch loading problem before and it was always because i had something not configured correctly. are you using h264/aac as the codec and have you enabled keyinit

Kakadu

Comment #133: Thu, 18 Sep 2014, 21:03 (GMT+1, DST)

Quote


Quote: Tatokis

I am trying to make this awesome program work with twitch.tv but I can't for some reason.
I have pasted the rtmp link with the API key, I have set FLV as the container, set the encoder to libx264 (with ffmpeg) and audio encoder AAC at 64kbps but each time I press start recording, I get:

Quote

RTMP_ReadPacket, failed to read RTMP packet header
[Muxer::Init] Error: Can't open output file!
[PageRecord::RecordStart] Error: Something went wrong during initialization.

Recording works fine, it is just that I can't stream to twitch.
Thanks in advance
--
EDIT: Nevermind, strangely enough it works now. I didn't change anything!
Maybe it was a twitch issue.
Anyway, keep up the good work!

I have the same problem with hitbox and twitch and it doesn't dissappear.

Quote

[PageRecord::StartOutput] Starting output ...
[Muxer::Init] Using format flv (FLV (Flash Video)).
RTMP_ReadPacket, failed to read RTMP packet header
[Muxer::Init] Error: Can't open output file!
[PageRecord::StartOutput] Error: Something went wrong during initialization.

I can stream on twitch using https://github.com/wargio/Twitch-Streamer-Linux.git so It is issue of SSR. Any ideas how to debug this?

Maarten Baert

Administrator

Comment #134: Sat, 20 Sep 2014, 18:13 (GMT+1, DST)

Quote


Quote: Kakadu

I have the same problem with hitbox and twitch and it doesn't dissappear.

Quote

[PageRecord::StartOutput] Starting output ...
[Muxer::Init] Using format flv (FLV (Flash Video)).
RTMP_ReadPacket, failed to read RTMP packet header
[Muxer::Init] Error: Can't open output file!
[PageRecord::StartOutput] Error: Something went wrong during initialization.

I can stream on twitch using https://github.com/wargio/Twitch-Streamer-Linux.git so It is issue of SSR. Any ideas how to debug this?

Double-check all your settings. The most likely explanation is that something is set incorrectly. Make sure 'separate file per segment' is off. Use the settings from one of the 'Live Stream' presets.

Can you send me the entire SSR log file? It is saved in ~/.ssr/logs. Which Linux distribution are you using?

Kakadu

Comment #135: Sat, 20 Sep 2014, 22:46 (GMT+1, DST)

Quote


Quote: Maarten Baert

Double-check all your settings. The most likely explanation is that something is set incorrectly. Make sure 'separate file per segment' is off. Use the settings from one of the 'Live Stream' presets.

Can you send me the entire SSR log file? It is saved in ~/.ssr/logs. Which Linux distribution are you using?

Yeah, 'separate file per segment' was the reason, thanks.

Btw, if somebody will get '[libx264 @ 0x298db40] Error setting preset/tune fastest/(null)' you need to change preset, for example to fast.

Maarten Baert

Administrator

Comment #136: Sun, 21 Sep 2014, 19:17 (GMT+1, DST)

Quote


Quote: Kakadu
Quote: Maarten Baert

Double-check all your settings. The most likely explanation is that something is set incorrectly. Make sure 'separate file per segment' is off. Use the settings from one of the 'Live Stream' presets.

Can you send me the entire SSR log file? It is saved in ~/.ssr/logs. Which Linux distribution are you using?

Yeah, 'separate file per segment' was the reason, thanks.

Btw, if somebody will get '[libx264 @ 0x298db40] Error setting preset/tune fastest/(null)' you need to change preset, for example to fast.

'fastest' is not a valid preset. Valid names are listed here:
http://mewiki.project357.com/wiki/X264_Settings#preset

Fusionlightcat

Comment #137: Sun, 28 Sep 2014, 10:09 (GMT+1, DST)

Quote


Hello

Ive got no problem with SSR itself, but i just cant get a twitch streamkey.
When i click on your link, i have to login and after this just a small text appears:
"You are beeing redirected"

Nothing happens. When i click manually on "redirected" my browser goes to
http://www.twitch.tv/maartenbaert/dashboard/
and i get the same message.

I tried it with Firefox and Google Chrome but that changed nothing.

Hope you can help!
Thankyou!

Maarten Baert

Administrator

Comment #138: Sun, 28 Sep 2014, 15:11 (GMT+1, DST)

Quote


Quote: Fusionlightcat

Hello

Ive got no problem with SSR itself, but i just cant get a twitch streamkey.
When i click on your link, i have to login and after this just a small text appears:
"You are beeing redirected"

Nothing happens. When i click manually on "redirected" my browser goes to
http://www.twitch.tv/maartenbaert/dashboard/
and i get the same message.

I tried it with Firefox and Google Chrome but that changed nothing.

Hope you can help!
Thankyou!

Twitch changed their URL system, it now includes your username. So you have to replace 'maartenbaert' with your own username. I've removed that link now, it's probably just confusing people.

Ubuntuaddicted

Comment #139: Wed, 15 Oct 2014, 16:00 (GMT+1, DST)

Quote


I just wanted to post a huge THANK YOU! SSR is my go to software for livestreaming my gaming sessions to twitch and hitbox when I'm gaming in linux. I have been trying out obs-studio but since they don't have a syncronizer built into their software I'm getting horrible audio/video desync occurring. After only 5 minutes of livestreaming and local recording the audio is about 1 second ahead of the video. I constantly ask them why they don't look at your syncronizer code to get an idea of how you handle it but apparently they're stuck in their ways. They're claiming that pulseaudio has a buffer rewind bug that's the cause but clearly whatever you've done to get the audio/video in sync works.

So again THANK YOU for the great piece of software. Only thing I'm missing is an overlay in my livestream when I use ssr and it's a little annoying that my webcam guvcview window sits on top of the game window so i can't see a corner of the game i'm playing but it's normally not that big of a deal.

Maarten Baert

Administrator

Comment #140: Thu, 16 Oct 2014, 23:22 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

I just wanted to post a huge THANK YOU! SSR is my go to software for livestreaming my gaming sessions to twitch and hitbox when I'm gaming in linux. I have been trying out obs-studio but since they don't have a syncronizer built into their software I'm getting horrible audio/video desync occurring. After only 5 minutes of livestreaming and local recording the audio is about 1 second ahead of the video. I constantly ask them why they don't look at your syncronizer code to get an idea of how you handle it but apparently they're stuck in their ways. They're claiming that pulseaudio has a buffer rewind bug that's the cause but clearly whatever you've done to get the audio/video in sync works.

Well they are probably right about PulseAudio, but that's only part of the problem. There's also clock drift, even when you're just using pure ALSA.

When PulseAudio decides to go completely crazy, even the SSR synchronizer won't be able to produce some decent sound ;).

Quote: Ubuntuaddicted

So again THANK YOU for the great piece of software. Only thing I'm missing is an overlay in my livestream when I use ssr and it's a little annoying that my webcam guvcview window sits on top of the game window so i can't see a corner of the game i'm playing but it's normally not that big of a deal.

SSR will get that feature - eventually :).

Ubuntuaddicted

Comment #141: Fri, 17 Oct 2014, 23:21 (GMT+1, DST)

Quote


is it possible to save a copy of the livestream locally as well as stream it? doesn't the stream data get written to /tmp possibly before it's streamed or am i wrong there?

Maarten Baert

Administrator

Comment #142: Sun, 19 Oct 2014, 13:48 (GMT+1, DST)

Quote


Quote: Ubuntuaddicted

is it possible to save a copy of the livestream locally as well as stream it? doesn't the stream data get written to /tmp possibly before it's streamed or am i wrong there?

No, it doesn't work like that. Currently ffmpeg doesn't provide a way to do this, so this will have to wait until I have time to implement my own RTMP streaming code (which is also necessary for streaming with a delay, automatic reconnecting, proper error messages and a few other things).

Ubuntuaddicted

Comment #143: Sun, 19 Oct 2014, 19:24 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Ubuntuaddicted

is it possible to save a copy of the livestream locally as well as stream it? doesn't the stream data get written to /tmp possibly before it's streamed or am i wrong there?

No, it doesn't work like that. Currently ffmpeg doesn't provide a way to do this, so this will have to wait until I have time to implement my own RTMP streaming code (which is also necessary for streaming with a delay, automatic reconnecting, proper error messages and a few other things).

ok, i currently use nginx and a rtmp-module to dual stream to both hitbox and twitch so maybe you can utilize the rtmp-module that's already been coded. so i just tell ssr to stream to my rtmp://192.168.0.6/live and then the conf file for nginx just "pushes" each stream to where i tell it.

Write a comment