ffmpeg: Continiously encode and append base64 data chunks into output file

Viewed 834

I have a .mov file thats being written into by my iphone cam saved as input.mov and I have a script that's reading the currently updating file and I am trying to encode the video and audio codec into a .mkv container.

I have little knowledge of this tool, but looking at similar Q/A's around ffmpeg usage I have found little on using base64 as input. But it is documented by ffmpeg for images, so I assume it is possible and I have also used data:video/mp4 since these file types are very similar.

I have:

const ifRecordingStream = await fs.readStream('input.mov', 'base64', 4095);
ifRecordingStream.open();

ifRecordingStream.onData((chunk) => 
    execute(`ffmpeg -f concat -i "data:video/mp4;base64,${chunk} -c:v h264 -c:a aac output.mkv")
);

onData() currently throws Line {}: unknown keyword {}

Is my command wrong?

ffmpeg -f concat -i "data:video/mp4;base64,${chunk}" -c:v h264 -c:a aac output.mkv

Any help at all is welcomed.

1 Answers
Related