Avatar of aclaus225
aclaus225
 asked on

Understanding Streaming Issue

Today I used Facebook Live with Wirecast's presets of 4 Mbps and 30 fps. In an hour I had over 65000 drops frames. My camera is set to 29.97 which I guess explains some of the dropped frames, but when I viewed my completed video it was only 36 minutes and the audio was at least 3 minutes behind the video. Is this because I don't have enough bandwidth or is there another problem with my computer? I never noticed my processor nor memory maxxing out.
Multimedia ProgrammingFacebookHardware

Avatar of undefined
Last Comment
Owen Rubin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Owen Rubin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
aclaus225

ASKER
When I say three minutes it is a conservative estimate. For the last three minutes of the stream that speaker was not on stage and the video cuts off when I stopped the stream.
For the first 40 minutes real-time there was no audio at all because it wouldn't stream. When I did get it to finally stream then what I was hearing going out was in sync with the video.
Owen Rubin

That is fine, I was just trying to save doing math to see if I could figure out why.

What player are you using to watch the video? Have you tried VLC?
aclaus225

ASKER
I did it by accident. I reported my comment after I realized that I marked it as solved. I did not discover anything yet.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Owen Rubin

Thanks. Took me by surprise!  :-)
aclaus225

ASKER
Alright, so the video displays as being 34:51 in Facebook Videos and the true length is 1:01:06.  As far as codecs, I used the Wirecast defaults.  I know it defaults to 720p30 and 4 mb.
aclaus225

ASKER
Everything I read says that Wirecast's default settings should work with Facebook Live, but mostly selecting their defaults, I cannot change anything, so I know it is doing H.264, 44.100 on audio, along with 128kbps.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
aclaus225

ASKER
This is the streaming video that is messed up.  I know that there are skips in it, but my original estimate was wrong.  He stopped talking over 5 minutes before the video ended.  
https://www.facebook.com/westminstercalifornia/videos/352490802022229/ is the bad video.  I re-streamed the audio with a mostly empty room with full audio: https://www.facebook.com/westminstercalifornia/videos/1994290007544906/
Owen Rubin

But was the audio ever correct, even at the beginning?

I am failry sure that all those dropped frames have added up to a lot of sync errors. I do not know that codec you used, but if it does not do keyframes (a place where a full video frame is saved) often enough, sync can be a big issue, especially with that many dropped frames.

Back of envelope, the difference between 29.97 fps and 30 fps can cause some errors:
29.97 fps in one hour is 107892 frames  (basically, frames per hour)
30.00 fps in one hour is 108000 frames  (basically, frames per hour)
In one hour, the difference is about 62892 frames, not far off from your dropped frames count. So a difference between the 29.97 and 30.00 frames IF the playback speed is wrong can be very big.
Think what 62829 frames at 30 fps = approx 2094 seconds, or 34.9 minutes difference.

I am guessing the playback rate may be wrong, causing you to "loose" that much time, and get way out of sync.
aclaus225

ASKER
The video that ended up on Facebook was never in sync. The video that I saw being sent from the computer was in sync. So, I guess, my question would be, are dropped frames on input or output? In other words, am I dropping frames from the capture or on encoding?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Owen Rubin

I guess I would have to see a diagram of how it is all connected and study the pieces. But fairly sure that the two systems were running at different rates, which caused problems. Any place where the frame rate changed can be a cause of dropped frames. I am not sure in your set up where it went from 30 to 29.97, but I suspect the encoding.

In the future, they should all be at the same video rate and you can always transcode (to a different rate) after you have a good master.

Can you get access to the file on the computer to encode again?
Owen Rubin

As a side note,  I tried to convert some HD video into SD video, and had the creeping sync errors, and for me, it was.not using the same video rate as the source. But what happens when you can’t use the same rate?

Just as an example: Frame rate was a problem when converting film, at 24 fps to video at (approx) 30 fps for TV. It required encoding trick called 3:2 pull down. This is a great example of how things might go badly, and a clever trick to get around it. The conversion really shows up in a panning scene where you can see a small stutter in the video that was not in the film. Otherwise the film would run silly fast.

C28D627F-260D-4D1F-B24F-7239C8877AD.jpeg
Similar problem was seen when British TV (PAL) is 625 lines at 50 fields/s (25 frames per second) is converted to  American TV (NTSC) is 525 lines at 59.94 fields/s (60,000/1,001 fields/s). Aside from the line count being different, converting to a format that requires 60 fields every second from a format that has only 50 fields poses difficulty. Every second, an additional 10 fields must be generated—the converter has to create new frames (from the existing input) in real time. Often, British TV in America runs a bit faster than in Britain.

Just a few examples to show that this has been a problem for some time now.
aclaus225

ASKER
The video was encoded live with no recording existing apart from what was sent to Facebook so I cannot encode it again.

My camera itself runs at either 59.94 or 29.97 fps and Wirecast was configured for 30 fps. The video should have come off my camera, gone to Wirecast, then gone to Facebook. OBS Studio and FMLE do not seem to have any issues, apart from lines in OBS if the people move, but no dropped frames.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
aclaus225

ASKER
The bitrate is automatically set at 4128k in Wirecast, which makes sense.  It is using 4000k for video and 128k for audio.  I was also wrong on the audio sample rate, which is 48.000 not 44.100.
wirecastpresets.jpg
aclaus225

ASKER
In the end, I changed Wirecast to my own presets of 29.97 fps and 1 Mbps and everything works with 1 total frame dropped.

I think the combination of 4 Mbps and 30 fps that Wirecast uses simply overloaded the computer.
Owen Rubin

Excellent. I am actually surprised in the setup you described that you should have had such problems, so maybe it happened after it got to Wirecast, but happy that you were able to get things working. These kinds of errors are often a surprise, and actually Wirecast should have been able to detect your incoming stream info and transcode it properly.

Cheers
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck