0

I'm sending a live stream of bitmaps to ffmpeg through standardin like this:

proc.StartInfo.Arguments = "-rtbufsize 1500M -f image2pipe -r 25 -i pipe:.bmp -vcodec libx264 -r 25 C:\\test.avi";

The resulting video saves and plays with no problems.

I want to add audio while the bitmaps are streaming, so I tested grabbing audio alone like this:

proc.StartInfo.Arguments = "-rtbufsize 1500M -f dshow -i audio=" + '"' + "Stereo Mix (Realtek High Defini" + '"' + " -acodec pcm_s16le -ac 2 -ar 48000 C:\\test.wav";

The audio saves and plays well.

I can combine the two later, after they're saved, by using -vcodec copy -acodec copy

My question is if it is possible to merge both live streams as they are created on the fly and how to do it.

1 Answer 1

0

You can combine them like below,

proc.StartInfo.Arguments = "-rtbufsize 1500M -f image2pipe -r 25 -i pipe:.bmp -rtbufsize 1500M -f dshow -i audio=" + '"' + "Stereo Mix (Realtek High Defini" + '"' + " -vcodec libx264 -r 25 -acodec pcm_s16le -ac 2 -ar 48000 C:\\test.avi";
3
  • Any idea why when played in vlc, the video doesn't show the length. I'm sure it's something on my end, perhaps the stream is not exiting gracefully?
    – AY125
    May 19, 2016 at 20:08
  • Try saving to MOV instead of AVI.
    – Gyan
    May 19, 2016 at 20:16
  • Thanks @Mulvya, but saving to MOV or any other container didn't do it. The combined video is sometimes out of sync because of dropped frames. Adding -shortest makes vlc show correct length of video, I should say length of audio because video ends before audio. It's a question of how to sync now and is better asked separately, as per superuser.com protocol.
    – AY125
    Jun 5, 2016 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .