I need to record a video stream and mix it with audio from external device (USB sound card). I managed to record the video and audio separately with following commands.
ffmpeg -i rtsp://192.168.0.192 -acodec copy -vcodec copy ~/out.mp4
ffmpeg -f alsa -i hw:1 -t 30 out.wav
Now I need to record both at the same time and create an mp4 file.
I tried this command, but it gives me an error.
ffmpeg -f alsa -i hw:1 -i rtsp://192.168.0.192 -acodec copy -vcodec copy ~/out.mp4 Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
EDIT: Using mkv container instead of mp4 works. How should I encode the video to be able to store it as mp4?