Video and audio are not synchronized in mp4 container
sonntex
sonntex at gmail.com
Sat Mar 18 11:54:51 UTC 2017
I have small utility that reads annex-b h264 and adts aac streams from two
pipes and writes them to one mp4 container. Both pipes have live streams
from v4l2 and alsa devices. As you can see, I added is-live property to
fdsrc. Without this property pts and dts of the video stream were corrupted.
#!/bin/sh
timeout=60
usage() {
echo "Usage: $(basename $0) [OPTIONS] <VIDEOPIPE> <AUDIOPIPE> <MASK>"
echo " -o arg (=$timeout) timeout"
exit 0
}
OPTIND=1
while getopts "o:" opt
do
case $opt in
o) timeout=$OPTARG
;;
*) usage
;;
esac
done
shift $((OPTIND-1))
[ $# -ne 3 ] && usage
video_pipe="$1"
audio_pipe="$2"
mask="$3"
exec 3<> "$video_pipe"
exec 4<> "$audio_pipe"
gst-launch-1.0 -qe \
fdsrc fd=3 do-timestamp=true is-live=true \
! queue \
! h264parse \
! video/x-h264,stream-format=avc,alignment=au \
! mux.video \
fdsrc fd=4 do-timestamp=true is-live=true \
! queue \
! aacparse \
! audio/mpeg,stream-format=raw \
! mux.audio_0 \
splitmuxsink name=mux location="$mask" max-size-time="${timeout}
000000000"
The problem is that video and audio streams in mp4 file are not
synchronized (or something else). Video looks good, but audio stream has
periodically pauses about one second long. There are same pauses in audio
stream after remuxing it from mp4 container with audio and video streams to
another mp4 container without video stream. But result is good if I first
mux only audio stream from audio pipe to mp4 container without video
stream. So, I think that video stream affects to this problem.
I already tryed to set sync property of splitmuxsink to true or false. It
did not help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170318/7c21f308/attachment.html>
More information about the gstreamer-devel
mailing list