[FFmpeg-user] HELP !!Audio + video sync when both stream copy from USB webcam

Huang Soho soho123.2012 at gmail.com
Tue Sep 3 13:07:04 CEST 2013


Hi All,

I use ffmpeg + ffserver to support a stream server.
but there is a big problem when Audio + video.
both audio and video are use "stream copy" option.
I can use ffplay to play the rtp stream  by the url "rtsp://
192.168.1.254:5554/test1-rtsp.mpg"

the conf of ffserver is :

<Stream test1-rtsp.mpg>
Feed feed2.ffm
Format rtp
AVOptionVideo flags +global_header
VideoSize 1280x720
VideoFrameRate 30
VideoCodec libx264

AVOptionAudio flags +global_header
AudioCodec pcm_s16be
AudioChannels 2
AudioSampleRate 48000
</Stream>

the ffmpeg command is :
ffmpeg -sn -f video4linux2 -r 30 -s 1280x720 -input_format h264 -i
/dev/video1 -f alsa -ar 48000 -ac 2 -i hw:0 -vcodec copy -acodec copy -map
0:0 -map 1:0 http://localhost:8090/feed2.ffm

Audio is played earlier than video about 3~5 seonds or more than 5 seconds.
why Audio will be playied for a few seconds?

I can see , ffmpeg capture the data from USB webcam and USB sound card by
interleaved
Is there any option can be used for fine tune ?
Any input is very appreciated!!!


More information about the ffmpeg-user mailing list