[FFmpeg-user] Muxing Video from Cam1 with Audio from Cam2?

Steven Kan steven at kan.org
Sat Feb 20 04:23:52 EET 2021


After buying 6 new IP cameras recently, I have suddenly discovered that none of them has a microphone :facepalm:

I can’t return them because I’ve done some surgery on them to bypass their 12 V power input diodes, but now I want to stream video from them with audio. I do have a crummy older IP camera laying around that does have audio, but the video quality and features are not what I want.

What’s the correct syntax to mux the video from new Cam1 with the audio from older Cam2, while completely discarding the unwanted video from Cam2? Preferably without transcoding anything, since I want to minimize CPU usage. I ran the following command, but it just stalls at time=00:00:09.58 and never returns, and the resulting out.mp4 is an invalid movie with a size of 44 bytes. How do apply “-vn” to Input #1 only? Thanks!

ffmpeg -re -thread_queue_size 1024 -rtsp_transport tcp -i "rtsp://anonymous:password1@192.168.1.13:554/cam/realmonitor?channel=1&subtype=0" -i "rtsp://anonymous:password@192.168.1.39:554" -vn -acodec copy -t 00:00:10 out.mp4

ffmpeg version N-100466-g29cef1bcd6-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 62.100 / 56. 62.100
  libavcodec     58.115.102 / 58.115.102
  libavformat    58. 65.100 / 58. 65.100
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 94.100 /  7. 94.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, rtsp, from 'rtsp://anonymous:password1@192.168.1.13:554/cam/realmonitor?channel=1&subtype=0':
  Metadata:
    title           : Media Server
  Duration: N/A, start: 0.100000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 100 tbr, 90k tbn, 180k tbc
Input #1, rtsp, from 'rtsp://anonymous:password@192.168.1.39:554':
  Metadata:
    title           : Session streamed by "preview"
    comment         : 
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: h264 (High), yuv420p(progressive), 2560x1440, 29.97 tbr, 90k tbn, 180k tbc
    Stream #1:1: Audio: aac (LC), 16000 Hz, mono, fltp
Output #0, mp4, to 'out.mp4':
  Metadata:
    title           : Media Server
    encoder         : Lavf58.65.100
    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp
Stream mapping:
  Stream #1:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
[rtsp @ 0x7fa887008000] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[rtsp @ 0x7fa887008000] max delay reached. need to consume packetx    
[rtsp @ 0x7fa887008000] RTP: missed 1 packets
size=       0kB time=00:00:09.58 bitrate=   0.0kbits/s speed=1.11x    



More information about the ffmpeg-user mailing list