webrtc
webrtc copied to clipboard
VP8 Recorded file.ivf has incorrect duration and playback speed
VP8 Recorded file.ivf has incorrect duration and playback speed. Any video player shows 6 sec reord length, but plays more in fact.
How can i fix video record speed and duration?
Hey @Demuzx
Is it still incorrect after calling Close
on the file like here https://github.com/pion/webrtc/blob/master/examples/save-to-disk/main.go#L115 ?
We also have this PR, but I haven't had time to work on it yet https://github.com/pion/webrtc/pull/680
We can't use the wall clock (since packets might be coming faster then playback speed) but I haven't dug in yet.
Is it still incorrect after calling
Close
on the file like here https://github.com/pion/webrtc/blob/master/examples/save-to-disk/main.go#L115 ?
Yes, it is still incorrect, even i close file. And the playback speed of the recorded file from the camera and the recorded file of the screen is differ in speed
Hey @Demuzx
Is it still incorrect after calling
Close
on the file like here https://github.com/pion/webrtc/blob/master/examples/save-to-disk/main.go#L115 ?We also have this PR, but I haven't had time to work on it yet #680
We can't use the wall clock (since packets might be coming faster then playback speed) but I haven't dug in yet.
Actually the PR is not considering variable rate nor faster than playback speed. The correct way would be to have the framerate from other endpoint at some point (begin or end of stream), but for live stream it is working in an acceptable way.
It is also broken on fixating the width and height.
Is it still incorrect after calling
Close
on the file like here https://github.com/pion/webrtc/blob/master/examples/save-to-disk/main.go#L115 ?Yes, it is still incorrect, even i close file. And the playback speed of the recorded file from the camera and the recorded file of the screen is differ in speed
The thing is that framerate is fixed and probably different than your camera.
Hey @Demuzx
Is it still incorrect after calling
Close
on the file like here https://github.com/pion/webrtc/blob/master/examples/save-to-disk/main.go#L115 ?We also have this PR, but I haven't had time to work on it yet #680
We can't use the wall clock (since packets might be coming faster then playback speed) but I haven't dug in yet.
Is there any way to define incoming stream frame rate that we receive from the client and paste this value to ivfWriter headers dynamically? Can you rewrite "NewWriter()" function to something like: ivfWriter.NewWriter(config), where config has more advanced configuration than currently available?
func (i *IVFWriter) writeHeader() error {
header := make([]byte, 32)
copy(header[0:], []byte("DKIF")) // DKIF
binary.LittleEndian.PutUint16(header[4:], 0) // Version
binary.LittleEndian.PutUint16(header[6:], 32) // Header Size
copy(header[8:], []byte("VP80")) // FOURCC
binary.LittleEndian.PutUint16(header[12:], 640) // Version
binary.LittleEndian.PutUint16(header[14:], 480) // Header Size
binary.LittleEndian.PutUint32(header[16:], 30) // Framerate numerator
binary.LittleEndian.PutUint32(header[20:], 1) // Framerate Denominator
binary.LittleEndian.PutUint32(header[24:], 60) // Frame count, will be updated on first Close() call
binary.LittleEndian.PutUint32(header[28:], 0) // Unused
_, err := i.stream.Write(header)
return err
}
@Demuzx
Is there any way to define incoming stream frame rate that we receive from the client and paste this value to ivfWriter headers dynamically? Can you rewrite "NewWriter()" function to something like: ivfWriter.NewWriter(config), where config has more advanced configuration than currently available?
func (i *IVFWriter) writeHeader() error { header := make([]byte, 32) copy(header[0:], []byte("DKIF")) // DKIF binary.LittleEndian.PutUint16(header[4:], 0) // Version binary.LittleEndian.PutUint16(header[6:], 32) // Header Size copy(header[8:], []byte("VP80")) // FOURCC binary.LittleEndian.PutUint16(header[12:], 640) // Version binary.LittleEndian.PutUint16(header[14:], 480) // Header Size binary.LittleEndian.PutUint32(header[16:], 30) // Framerate numerator binary.LittleEndian.PutUint32(header[20:], 1) // Framerate Denominator binary.LittleEndian.PutUint32(header[24:], 60) // Frame count, will be updated on first Close() call binary.LittleEndian.PutUint32(header[28:], 0) // Unused _, err := i.stream.Write(header) return err }
I don't know if the RFC mentions stream metadata transportation. If that is the case it would be good to get this information directly from WebRTC protocol.
I see no reason why this method should be static. I think it is that way only for lack of time to make the modification. A PR would be much appreciated.
Sorry I can't be more help guys :( I need to get TURN + DTL-PSK done.
Right after I can dig in though! If you want to jump on Slack or open PRs I will try my best to help.
Any update on it?
Any update on it?
If you are having issues with ivf playback #680 has seemingly fixed the issue or at least made it a workable solution. It sounds like the PR is not the correct way of doing it however based on @raphaelpereira description...