Log in

View Full Version : Merge different input sources with ffmpeg into one stream


burek021
5th May 2011, 15:45
Hi,

I'm trying to combine my sound card's input with my IP camera video (streamed via RTSP, using h.264 codec) and save it in a file. Do any of you have any experience with this?

This is the command I've tried:

# ffmpeg -y -r 30 -f rtsp -i rtsp://192.168.25.19/h264/media.amp?resolution=qvga -f alsa -ac 2 -i hw:0 -f mp4 -acodec libaacplus -ab 32k -ac 2 -vcodec copy video.mp4
ffmpeg version git-N-29592-g6dafa70, Copyright (c) 2000-2011 the FFmpeg developers
built on May 5 2011 02:42:48 with gcc 4.4.5
configuration: --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-runtime-cpudetect --enable-bzlib --enable-libfaac --enable-libgsm --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libx264 --enable-zlib --enable-libaacplus
libavutil 51. 2. 0 / 51. 2. 0
libavcodec 53. 3. 0 / 53. 3. 0
libavformat 53. 0. 3 / 53. 0. 3
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 0. 14. 0 / 0. 14. 0
libpostproc 51. 2. 0 / 51. 2. 0
[rtsp @ 0x1672d40] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2)
Input #0, rtsp, from 'rtsp://192.168.25.19/h264/media.amp?resolution=qvga':
Metadata:
title : Video Server Session
Duration: N/A, start: 2.573711, bitrate: N/A
Stream #0.0: Video: h264 (Baseline), yuv420p, 320x240, 90k tbr, 90k tbn, 180k tbc
[alsa @ 0x16755c0] Estimating duration from bitrate, this may be inaccurate
Input #1, alsa, from 'hw:0':
Duration: N/A, start: 10182.444658, bitrate: N/A
Stream #1.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, mp4, to 'video.mp4':
Metadata:
title : Video Server Session
encoder : Lavf53.0.3
Stream #0.0: Video: libx264, yuv420p, 320x240, q=2-31, 90k tbn, 90k tbc
Stream #0.1: Audio: libaacplus, 44100 Hz, 2 channels, s16, 32 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #1.0 -> #0.1
Press [q] to stop encoding
[mp4 @ 0x168c680] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 804143 >= 330281
av_interleaved_write_frame(): Invalid argument


Any help would really be appreciated..
Thanks.