ststeiger / webcamstudio

Automatically exported from code.google.com/p/webcamstudio
GNU General Public License v3.0
0 stars 0 forks source link

keyframe interface to max 2 seconds (for YouTube broadcast) #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.any videosource
2.FME file for Youtube Live
3.YouTube video choppy as the Keyframe frequency is too low (default 8.3 
seconds)

What is the expected output?
Fluent video received at YouTube

What do you see instead?
Choppy

Suggested fix: read keyframe_frequency from the xml file and use this as input 
to the parameter setting in the output.properties file when calling Broadcast 
settings

The Operating system you are using (Linux, Windows etc)?
Linux: Ubuntu Studio 13.10

What version of WebcamStudio are you using?
0.65

What version of Java are you using?
OpenJDK Java 7

What is your Webcamera vendor, model and version?
Using mobile phone:IP Webcam (Android)

For *nix users please enter the output from "sudo lsusb"?
Bus 002 Device 004: ID 194f:0103 PreSonus Audio Electronics, Inc. AudioBox 1818 
VSL
Bus 002 Device 003: ID 0781:5573 SanDisk Corp. 
Bus 002 Device 005: ID 18d1:4ee1 Google Inc. Nexus 4
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 046d:c404 Logitech, Inc. TrackMan Wheel
Bus 001 Device 003: ID 045e:0780 Microsoft Corp. 
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Original issue reported on code.google.com by skickm...@gmail.com on 9 Mar 2014 at 3:29

GoogleCodeExporter commented 9 years ago
Thanks for the useful infos. 
Where i can get the xml file for YouTube or can you provide me a sample?
I will look for the keyframe option in the WebcamStudio backend commands.
karl

Original comment by soylent...@gmail.com on 9 Mar 2014 at 7:51

GoogleCodeExporter commented 9 years ago
I'll handle this one.

Original comment by soylent...@gmail.com on 9 Mar 2014 at 7:53

GoogleCodeExporter commented 9 years ago
when you arrange the YouTube live session, you have two options:
1. feed the session through Google hang-out
2. link the stream directly into their server

The first option works with the virtual camera, but video quality is not great 
due to the default compression settings in Hangouts (I'm guessing as I've seen 
this with various virtual cam programs)

The second allows you to select your own encoder settings and the like, one of 
them provides the user with the fme.xml file. 
See attached a copy of one of those files I retrieved.
(the session specific link has been removed)

As you can see, this file offers various settings for optimal streaming.
Some of them are not used by Webcamstudio as the parser does not pick them up.

Keyframe_frequency is one of them.
The default setting for x.264 encoder is one key-frame every 250 frames.
At 30 fps, this yields a key frame interval of 8.3 seconds
YouTube recommends less than 2 seconds to prevent too much buffering of the 
video (which adds latency and less fluent video)

So if you use the Keyframe_frequency from the FME.xml file, I suggest to link 
this with the framerate, and set keyint at 2*framerate
I also read that you probably want to limit the frequency to 1*framerate.
This I beleive can be done with min-keyint
(at least with the options I gleaned from the x264 encoder, which should be 
available in avconv backend)

hope this makes sense :-)

Original comment by skickm...@gmail.com on 9 Mar 2014 at 11:28

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you a lot, i try to look at this now and let you know.
karl.

Original comment by soylent...@gmail.com on 10 Mar 2014 at 4:01

GoogleCodeExporter commented 9 years ago
Hi skickmail,
 can you test this jar please?

https://drive.google.com/file/d/0BxkZ_wh6t7jbdEpoZWJ6UzlsQ2M/edit?usp=sharing

I add the avconv "-g" parameter to set keyint_frequency. Seems that keyint_min 
is already set to 1 by default.
Once the jar i launched, you have to remove and add back the youtube xml file, 
if present.

I found that WS give me an error pharsing the sample you gave me at line 1, so 
I changed:

<?xml version="1.0" encoding="UTF-16"?>

to

<?xml version="1.0" encoding="UTF-8"?>

I will add a Youtube Live xml sample to use in WS if the test is Ok.
Thanks.
karl

Original comment by soylent...@gmail.com on 10 Mar 2014 at 8:24

GoogleCodeExporter commented 9 years ago
Hi Karl,

Sorry, you are overestimating my abilities to work with jar files :-)
I opened the link but did not know what to do with the files that are in the 
zip file.
I'll gladly try it out, but need a little help as to what to do.

Cheers,
RJ

Original comment by skickm...@gmail.com on 11 Mar 2014 at 1:26

GoogleCodeExporter commented 9 years ago
Hi,
 sorry for the delay ...
First try to download this archive because in the other I posted there were a 
bug  in UDP-Out due to my modifications ...
Try this one:

https://drive.google.com/file/d/0BxkZ_wh6t7jbUnZGbW5NV0RVN1U/edit?usp=sharing

1)Download the zip file.
2)Extract it with file-roller in your home folder
3) Open a terminal and navigate to the "dist" just extracted
4) type this command:

$ java -jar WebcamStudio.jar

5) WebcamStudio will start, and in the terminal you can control all the actions 
taken, avconv and gstreamer commands line included ...

Let me know.
karl.

Original comment by soylent...@gmail.com on 11 Mar 2014 at 5:40

GoogleCodeExporter commented 9 years ago
Karl,

I tried it out and it seemed to work fine.
Did not need to change the UTF reference.
The FME file I downloaded from YouTube (specific for each session), was read 
fine
As soon as I dropped it in the output section I saw the following in the 
terminal:

Pharsed KeyInt: 60###

So that was good.

Then I started the session as usual and was streaming to YouTube.
Here's what invoked the link with the server: (removed the session streamkey)

SinkBroadcast registered.
Broadcasting to YouTube (480p Stream)
FMECount = 1
Port used is Video:53136/Audio:55801
Command: avconv -v 0 -s 854x480 -r 30 -f rawvideo -pix_fmt rgb24 -i 
tcp://127.0.0.1:53136 -ar 44100 -ac 2 -f s16be -i tcp://127.0.0.1:55801 -vcodec 
libx264 -maxrate 650k -r 30 -s 854x480 -acodec libmp3lame -ab 128k -ac 2 -ar 
44100 -g 60 -f flv -vcodec libx264 -s 854x480 -preset fast -tune zerolatency 
-minrate 650k -maxrate 650k -bufsize 650k -acodec libmp3lame -ar 44100 -threads 
6 -qscale 3 "rtmp://a.rtmp.youtube.com/live2/streamkey live=1 
flashver=FME/2.520(compatible;20FMSc201.0)"
Video output accepted
Audio output accepted

During the session YouTube did not complain about the interval anymore :-)

So I'd say this works!!

Thanks.
I'll do some more tests later this week when I have a moment.
If I find any other issues, I'll let you know.

out of curiosity:
will selecting a different back-end affect the calls?
I did not see this, but wanted to make sure.

second curiosity: where in the avconc call do you specify the keyint?
I did not recognize the setting in the parameters used.

Cheers,
RJ

Original comment by skickm...@gmail.com on 13 Mar 2014 at 4:11

GoogleCodeExporter commented 9 years ago
Thanks for the feedback :)
The parameter for keyint is the "-g" entry for avconv.
For the outputs, if you activate the ffmpeg button at the top bar of WS, only 
the avconv calls will change the backend to ffmpeg, but some FME like Icecast 
and Red5 will still use gstreamer anyway.
karl. 

Original comment by soylent...@gmail.com on 15 Mar 2014 at 7:15

GoogleCodeExporter commented 9 years ago
Implemented avconv "-g" parameter to set keyint_frequency for FMEs

Original comment by soylent...@gmail.com on 28 Apr 2014 at 8:03