robertdoo / red5

Automatically exported from code.google.com/p/red5
0 stars 0 forks source link

Recorded video jumping when playing it back from flash player #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
In our application we allow the publishing and playing of live streams from a 
flex client. We also allow that flex client to replay the recorded streams too. 
We found no problem with the live streams, but when we replayed them later on, 
the video was jumping (only on flash player, not on other players such as VLC), 
as if there were gaps on the recorded file.
One of the flex devs here found out that if the stream contained both audio and 
video, as soon as the audio went completely silent, that will produce a gap on 
the video as it was not saving a timestamp. That is a problem for us since we 
rely on the silence level setting for the microphone, and we may send empty 
audio packets frequently. So i modified red5 with the attached patch and its 
been working perfectly for a couple of months already.
Basically, it will make the FLVWriter.writeTag method to perform the writing 
even if the body of the given tag is empty, therefore saving a timestamp on the 
file.
I try to keep the latest code from red5 up to date, but since i've read you are 
planning on releasing 1.0 shortly, maybe its a good idea to merge it into 
trunk. What do you think?
Thanks

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

Please use labels and text to provide additional information.

Original issue reported on code.google.com by daccatt...@gmail.com on 28 Jan 2011 at 6:11

Attachments:

GoogleCodeExporter commented 9 years ago
Yes we are having the exact same issues!

Original comment by K2xL....@gmail.com on 7 Apr 2011 at 12:20

GoogleCodeExporter commented 9 years ago
Fixed attachment

Original comment by mondain on 25 Jul 2011 at 4:11

Attachments:

GoogleCodeExporter commented 9 years ago
I'll review and possibly apply the patch today.

Original comment by mondain on 28 Jul 2011 at 6:19

GoogleCodeExporter commented 9 years ago
Empty audio tags for FLV recording has been added at revision 4271. Please 
update your red5 install and try with this revision or newer.

Original comment by mondain on 5 Aug 2011 at 8:38

GoogleCodeExporter commented 9 years ago
I tried the latest build rc4273 with a recording app and got the following 
result:
using a streamname of "1", red5 saved "1.flv" and "1.flv.ser". The recording 
did not seem to stop on disconnection of the flash client.

the logs show:
[INFO] [NioProcessor-8] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - 
Action createStream
[INFO] [NioProcessor-8] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - 
Action play
[INFO] [NioProcessor-8] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - 
Action pause
[ERROR] [NioProcessor-8] org.red5.io.flv.impl.FLVReader - New position exceeds 
limit
[INFO] [NioProcessor-8] org.red5.io.flv.impl.FLVReader - New position 14908424 
exceeds limit 10012171

Original comment by che...@gmail.com on 7 Aug 2011 at 10:11

GoogleCodeExporter commented 9 years ago
Followup:
In order to rule out issues of my app, i reproduced the error in The publisher 
demo, recording to oflaDemo.

-rw-r--r-- 1 mood mood  171873 2011-08-07 15:20 teststream.flv
-rw-r--r-- 1 mood mood     277 2011-08-07 15:19 teststream.flv.meta
-rw-r--r-- 1 mood mood 2818483 2011-08-07 15:18 teststream.flv.ser

teststream.flv continues to be written even after disconnecting  the publisher
platform is jeos-8.04 running in a vmware virtual machine.

Original comment by che...@gmail.com on 7 Aug 2011 at 10:28

GoogleCodeExporter commented 9 years ago
If the "ser" (serial) file was still there then the bytes had not finished 
transferring to the "flv". Watching an incomplete file is not covered here. I 
suggest that you wait for the Record.Stop before disconnecting and depending 
upon the size of your file this may take a little bit of time

Original comment by mondain on 8 Aug 2011 at 1:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tested a new recording following that procedure like this:
I set up the publisher app for recording to oflaDemo.
I started recording "recording" and stopped the recording with the button in 
publisher, not leaving the page or disconnecting.
Publisher did not give any feedback that the recording was stopped
I waited until record.flv was completely written and record.flv.ser removed
I then hit oflaDemo and tried to play record.flv with no success and the 
following result:
(28386) recording.flv: 
(28594) NetStream.onStatus: 
  clientid = 1
  details = recording.flv
  description = Playing and resetting recording.flv.
  code = NetStream.Play.Reset
  level = status

(28597) NetStream.onStatus: 
  clientid = 1
  details = recording.flv
  description = Started playing recording.flv.
  code = NetStream.Play.Start
  level = status

(28644) NetStream.onStatus: 
  clientid = 1
  details = recording.flv
  description = Stopped playing recording.flv.
  code = NetStream.Play.Stop
  level = status

(28710) NetStream.onStatus: 
  level = status
  code = NetStream.Buffer.Flush

red5.log shows several exceptions, in the AbstractPipe, ServiceInvoker and 
InMemoryPullPullPipe, logs attached.

Can i provide more data that could help find the reason for this?

On a sidenote, the saving of the flv from the .ser was abysmally slow, i am not 
sure if the VM hit caching somewhere in between, i will therefore retry the 
same on a dedicated server to check if the result gets better.

On another sidenote, wouldn't it make more sense to save the .flv from the .ser 
to .flv.tmp first and finally rename it? That would prevent to make the final 
.flv available before complete writing in the first place, and avoid caveats 
for developers and integrators that would have to protect the file before it is 
written completely.

regards, Stefan

Original comment by che...@gmail.com on 8 Aug 2011 at 7:51

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Stefan,
I am experiencing a similar problem where the conversion from .ser to .flv is 
incredibly slow. I have another red5 installation on another server and whilst 
watching the file creation on the server I do not even see the .ser file get 
created. The flv is being encoded on the fly opposed to being converted after 
the recording has ended.
Just wondering if you found a solution to this problem?
Thanks,
Gareth

Original comment by gareth.f...@gmail.com on 31 Aug 2011 at 11:33

GoogleCodeExporter commented 9 years ago
Hi Gareth,
no, i just reverted to a pre patched version and just make sure there audio 
does not get cut via the client sided silence level. That works so far, since 
most recording equipment never drops under a certain noise level.
I assume the method used so far is not yet the ideal solution to the issue, i 
suppose the solution lies in recording actual "silence" packages.
Here is the theory, haven't got time yet to check that:
In live situations, a message just indicates that silence began and later on 
the flash client picks up broadcasting audio (that is to save bandwidth), but 
since those messages won't probably be saved nor considered during generation 
of metadata, on playback it cannot be "guessed" when the next audio will be 
available. The videoframes are not sent "live", so during the gaps there is 
nothing to sync the video frames to.

Hope that helps
Stefan

Original comment by che...@gmail.com on 31 Aug 2011 at 3:37

GoogleCodeExporter commented 9 years ago
Thanks for that Stefan. I've also reverted to an earlier version and the 
problem has gone. 

Original comment by gareth.f...@gmail.com on 31 Aug 2011 at 3:41

GoogleCodeExporter commented 9 years ago
Thanks to every ones who keeps this thread running because in fact there are a 
critical problem with the video recording.

I also tried the last version which seem to fix the problem when the record is 
made at low volume levels, however introduce the problem with the ".ser" file 
when takes an eternity to transfer the recorded bytes to the ".flv" file.

By the way I have also reverted to an early version and as workaround I set the 
microphone boost level to MAX. In this way seem work properly most of the time. 
However this is a very important issue that must be fixed yet.

regards, César

Original comment by cesar.ag...@gmail.com on 31 Aug 2011 at 4:17

GoogleCodeExporter commented 9 years ago
@cesar: your workaround seems to confirm the silence level theory. Apart of 
raising the microphone boost, have you tried switching of the silence level 
client sided (see flash.media.microphone api)? Usually, no regular recording 
device actually is mnoise free, and though the noise might be very low, there 
will still be data.

I am currently pretty busy on different projects, but if anyone gets around to 
log the ocurrence of a mentioned "silence event" that flash is supposed to send 
when the volume gets under the set silence level, that could lead somewhere.

As a path to a proper solution, i'd propose to generate an audio/video file 
with periods of absolute silence and encode it to a proper flv, then dump the 
resulting audio packets to see what they look like. Maybe it is possible to 
catch the silence event server sided and write similar "no audio" packages 
during live recording until new audio kicks in.

cheers,
Stefan

Original comment by che...@gmail.com on 31 Aug 2011 at 7:30

GoogleCodeExporter commented 9 years ago
@gareth which version you install? is it 0.8.0?

Original comment by erpushpa...@gmail.com on 5 Aug 2013 at 9:59

GoogleCodeExporter commented 9 years ago
@cesar I am using red5 1.0 for red5-video recorder, and i have this problem

While I press record the .ser file sometimes creates but sometimes not its not 
smooth really. What will be the problem? Do i need to install red5 0.8? Or this 
current version will fine to record. Please suggest.

Thanks
Pusp

Original comment by erpushpa...@gmail.com on 16 Sep 2013 at 5:40

GoogleCodeExporter commented 9 years ago
@pusp I never solved the problem completely but I was able to achieve good 
results playing with the quality and keyframe settings (I don't remember which 
ones worked best for me). I used red5 1.0.

Good luck!
César

Original comment by cesar.ag...@gmail.com on 20 Sep 2013 at 1:51