When looking at the first frames of ouput.flv using ffprobe, it starts with
about 30 audio frames. Then, after e.g. half a second, the first video
frame do show up. This is expected because I suppose ffmpeg has to wait for
the first key frame of the video.
So the record has approx. 30 audio frames for about half a second, after
this the video and audio frames do show up repeatedly.
Now when I convert the flv file to mp4 and run the mp4 file in a player,
players like Windows Media Player do play the video half a second later
compared to the audio, so audio is completely out of sync. (VLC player does
play it right by the way).
I could correct it with a video editor (shifting the audio track with half
a second), then it plays correctly in both Windows Media Player as well as
VLC player. But of course I would like to have a correct version right away.
Is there any way I can tell ffmpeg to start recording the audio channel
only after the first video keyframe is received?
Or can ffmpeg add time stamps explicitly (starting with 00:00:00.000) to
both audio and video frames channels when starting recording the RTMP
Or, after the fact, is there a way to remove the first set of audio frames
(from the flv or mp4 file) before the first video frame shows up without
converting the complete file again?
Have attached the log file of ffprobe, the first video frame shows up at
Any hints are much appreciated,
Re: audio / video out of sync after recording rtmp stream
okay, thanks, will try it out.
By the way, I also find this workaround myself: stripping off the first 4
seconds (corresponds to the keyframe interval) from the flv file using: -ss
As a result, the excessive audio frames are gone, have tested this with the
problematic record and it works as expected: audio and video are perfectly
in sync now!
Op za 13 apr. 2019 om 13:57 schreef Carl Eugen Hoyos <[hidden email]>:
> 2019-04-13 11:33 GMT+02:00, Frans Gouverne <[hidden email]>:
> > ffmpeg -y -i "rtmp:/domein/client/name live=1" -vcodec copy
> > -acodec copy -f ouput.flv
> Instead please use something like (untested):
> $ ffmpeg -f data -i rtmp://... -c copy -f data -map 0 out.flv
> if you cannot use mplayer -dumpstream or something equivalent.
> Carl Eugen
> ffmpeg-user mailing list
> [hidden email] > https://ffmpeg.org/mailman/listinfo/ffmpeg-user >
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".