I am trying to capture video and audio from an RTSP stream using ffmpeg-4.1.3-amd64-static. The stream is produced by VLC, and contains H.264 video and AC-3 audio. I can play the stream using VLC and both video and audio work perfectly, but the command:

ffmpeg -i rtsp:// -c:v copy -c:a ac3 test6.mov

produces an output file with a correct video stream and no audio stream, even though the ffmpeg output shows that both video and audio streams were detected (in the SDP, at least). Using -c:a copy makes no difference. It seems as though it is silently dropping all the input audio packets.

What am I doing wrong?

Here is some of the output, in case that is helpful (I have omitted some error messages related to failed H.264 decodes during probing, and the usual frame encoding lines):

ffmpeg version 4.1.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, rtsp, from 'rtsp://':
    title           : Unnamed
    comment         : N/A
  Duration: N/A, start: 227.227222, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
Output #0, mov, to 'test6.mov':
    title           : Unnamed
    comment         : N/A
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s
      encoder         : Lavc58.35.100 ac3
  • Looks like the output file has an ac3 audio stream. How are you verifying the presence of an audio stream? – llogan Apr 15 at 21:57
  • I first observed that vlc did not play any audio, so I used mediainfo, which only identified a video stream in the output file. – Richard Hussong Apr 16 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.