Avi movie file has extra data – update2

William Salibrici bsalibrici at latticeinc.com
Mon Feb 6 16:35:19 UTC 2017


ORIGINAL POST -->
The following pipeline works ok and produces an avi movie file. My development machine is windows 7 and I’m using GStreamer 1.8.2 with your windows pre-built binaries.

gst-launch-1.0.exe -e



avimux name=mux ! filesink location=C:/myfile.avi

sync=true



rtpbin latency=6000 name=rtpbin_A



udpsrc address="192.168.1.101" port=5018 timeout=0

caps="application/x-rtp,media=video,payload=97,clock-rate=90000,encoding-name=VP8" !



rtpbin_A.recv_rtp_sink_0

rtpbin_A. ! rtpvp8depay ! avdec_vp8 output-corrupt=true ! videoconvert ! videorate ! videoscale !

capsfilter caps="video/x-raw,height=288,width=352,framerate=30/1" !

avenc_mpeg4 ! queue ! mux.



udpsrc address="192.168.1.101" port=5020 timeout=0

caps="application/x-rtp,media=audio,clock-rate=48000,encoding-name=OPUS,payload=96" !



rtpbin_A.recv_rtp_sink_1

rtpbin_A. ! rtpopusdepay ! opusdec ! audioconvert ! audiorate !

capsfilter caps="audio/x-raw,format=S16LE,rate=8000,channels=1" !

mulawenc ! queue ! mux.


I can use the standard Windows media player to play the resultant avi file. However, there are two problems:

  1.  The avi file length is about 5 seconds longer that it should be.
  2.  When I play the movie, there is about a 5 second delay in the beginning before it starts to play. The first video frame appears frozen during this initial delay.

Once the movie starts to play it is all ok. All the audio and video data is there and the audio and video are in sync.
Can anyone tell me what is causing this extra data in the avi file and the initial play delay, and what changes should be made to the above pipeline to eliminate it? Also, does anyone know of an open source avi file chunk viewer? I would like to see what data is actually in the avi file.
Thanks so much for your help,
Bill

UPDATE ->
I thought maybe the standard Windows media player was responsible for the initial play delay so I tried the following gstreamer playback pipeline:

gst-launch-1.0 -e
filesrc location=C:/myfile.avi !
avidemux name=demux demux. ! queue ! avdec_mpeg4 ! videoconvert ! d3dvideosink
demux. ! queue ! mulawdec ! audioconvert ! directsoundsink

I get the same playback response as with the Windows media player with the same two issues mentioned above in my initial post! So this play delay appears to be a gstreamer issue.
I did google searches for avi file reader/viewer/chunk viewer and finally found a useful open source tool at http://ffmpeg.org/. They have a win32 command line tool named ffprobe that reads an avi file and displays a lot of info about what it contains. I looked at my test recording that has the initial play delay. It was decoded without problems. The stream info is correct. The audio and video frames also looked fine. The file had 15 frames between key frames for video. I didn’t see anything that looked suspicious or broken. The first key frame came early in the recording – within the first half second.
Help to resolve this would be greatly appreciated!
Bill

UPDATE2 ->
Eventually I realized that the ffprobe video data shows actual frames being placed into the file from the beginning with timestamps that are increasing correctly. Then I further realized that the videorate element was inserting the same frame over and over again from the beginning of the file because the receiver pipeline shown in my original post was started first and the sender side was started after some delay. Finally I did several tests with differing start delays for the sender and for all cases the initial playback delay matched the sender start delay! If I start the sender first and then the receiver, there is no problem - only a small playback start delay which can be ignored for my application. Audio and video are in sync and the movie plays out just fine. In my application I may not always be able to control which side starts first.
So I looked at the videorate element again and discovered it has the skip-to-first property [same for audiorate]. I set skip-to-first=true for both the videorate and audiorate elements in the receiver pipeline shown above. I also removed the audioconvert element of the audio leg since it wasn’t really needed. Now there is no more playback delay for video regardless of the sender start delay. However, now the problem is the audio ALWAYS lags the video by approximately 5 seconds!! Audio lags video now even when I start the sender side first.
Any suggestions on how to get audio and video back in sync again here? It looks like I need to somehow insert a 5 second delay for the video leg.
Thanks,
Bill

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170206/22ab00d1/attachment-0001.html>


More information about the gstreamer-devel mailing list