syncing rtsp video and audio

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

syncing rtsp video and audio

Jesper Taxbøl
I am trying to record a video stream from an IP camera. The camera is from
Alibaba and its boasting h.265 4K recording at 30fps + 8KHz Audio.

The product page is here:
https://www.alibaba.com/product-detail/SIP-E274K-1-2-
5-SONY_60584818808.html?spm=a2700.7724838.2017115.1.621e0c80r293BD

I have successfully configured the camera to stream 4K video at 30fps using
this command.

*ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.200/av0_0
<http://192.168.0.200/av0_0> -c:v copy -t 10 -y out.mp4*

I recieve the 4k h.265 encoded video, but the audio track is badly out of
sync.

A sample can be seen here:
http://s3-eu-west-1.amazonaws.com/recoordio-zoo/2017/down/sync3.mp4

Any idea on how to achieve better audio video sync? Am I loosing the sync
because of the aac audio codec?

For those interrested in why I care about a 8khz ausio signal: I only aim
to use it for syncing two cameras and a stereo audio input. I do the sync
by hooking the audio output of a raspberry PI to the two cameras line-in
and one of the stereo channels recording audio. The output plays a sine one
second after all recordings has started.  In that way I end up with two
video files and one stereo file. The camera files has video and my
controlsignal and the stereo has the actual sound in one channel and the
controlsignal in the other channel. Thus allowing me to sync the threew
channels in post. The rtsp sync problem is giving me trouble

Kind regards

Jesper



The full ffmpeg and ffprobe output is pasted below:
---------------------------------------------------
*ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.200/av0_0
<http://192.168.0.200/av0_0> -c:v copy -t 10 -y out.mp4*

ffmpeg version N-87041-gf61e2dcfc3 Copyright (c) 2000-2017 the FFmpeg
developers
  built with gcc 7.1.1 (GCC) 20170630
  configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-avisynth --enable-avresample
--enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl
--enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883
--enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 74.100 / 55. 74.100
  libavcodec     57.103.100 / 57.103.100
  libavformat    57. 77.100 / 57. 77.100
  libavdevice    57.  7.101 / 57.  7.101
  libavfilter     6.100.100 /  6.100.100
  libavresample   3.  6.  0 /  3.  6.  0
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.0.200/av0_0':
  Metadata:
    title           : av0_0
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
3840x2160, 25 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x55fa5aef6ec0] Too many bits 8832.000000 > 6144 per frame
requested, clamping to max
Output #0, mp4, to 'out.mp4':
  Metadata:
    title           : av0_0
    encoder         : Lavf57.77.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc,
bt709, progressive), 3840x2160, q=2-31, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp,
48 kb/s
    Metadata:
      encoder         : Lavc57.103.100 aac
[mp4 @ 0x55fa5aef5b00] Timestamps are unset in a packet for stream 0. This
is deprecated and will stop working in the future. Fix your code to set the
timestamps properly
frame=  250 fps= 28 q=-1.0 Lsize=    6650kB time=00:00:10.11
bitrate=5387.7kbits/s speed=1.12x
video:6598kB audio:48kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.057095%
[aac @ 0x55fa5aef6ec0] Qavg: 61411.211


----------------------------------------------
*ffprobe -rtsp_transport tcp rtsp://192.168.0.200/av0_0
<http://192.168.0.200/av0_0>*
ffprobe version N-87041-gf61e2dcfc3 Copyright (c) 2007-2017 the FFmpeg
developers
  built with gcc 7.1.1 (GCC) 20170630
  configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-avisynth --enable-avresample
--enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl
--enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883
--enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 74.100 / 55. 74.100
  libavcodec     57.103.100 / 57.103.100
  libavformat    57. 77.100 / 57. 77.100
  libavdevice    57.  7.101 / 57.  7.101
  libavfilter     6.100.100 /  6.100.100
  libavresample   3.  6.  0 /  3.  6.  0
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, rtsp, from 'rtsp://192.168.0.200/av0_0':
  Metadata:
    title           : av0_0
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
3840x2160, 24.92 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".