1

I'm trying to learn as I go but haven't managed to come up with the answer to my issue here. I'm trying to stream to a URL using the 'pi-camera-connect' package and the 'avconv' package.

The video on the URL is just black and no sound.

I've never really dealt with streams before, so I imagine I'm doing all sorts wrong. Would appreciate the help.

const { StreamCamera, Codec } = require("pi-camera-connect");
var avconv = require('avconv');

const streamCamera = new StreamCamera({
    codec: Codec.H264
});

const runApp = async () => {

    const videoStream = streamCamera.createStream();
    await streamCamera.startCapture();

    var URL = "HIDDEN_URL";

    var params = [
        '-i', 'pipe:0', // Tell avconv to expect an input stream (via its stdin)
        '-f', 'flv',  
        '-strict', 'experimental',
        URL
    ];

    var process = avconv(params);

    process.on('error', function(data) {
        console.log("Stream Error", data.toString());
    });

    process.on('data', function(data) {
        console.log("Stream data", data.toString());
    });

    process.once('exit', function(exitCode, signal, metadata) {
        console.log("Stream Exit", exitCode.toString());
    });

    process.on('progress', function(progress) {
        console.log("Stream progress", progress.toString());
    });

    videoStream.pipe(process);

}

runApp();

It does generate the 'The driver for the TC358743 HDMI to CSI2 chip you are using is NOT supported' error but I understand that's always written out. Nothing else ends up in the console log.

I have been able to use the 'pi-camera' node package and write a new video file but I don't know how to use pi-camera to create a stream to send to the avconv process.

1

Never mind. Looks like I needed to add the -vcodec parameter.

var params = [
    '-i', 'pipe:0', // Tell avconv to expect an input stream (via its stdin)
    '-f', 'flv',  
    '-vcodec', 'copy',
    '-strict', 'experimental',
    URL
];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.