Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (10)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (4300)

  • webrtc to rtmp send video from camera to rtmp link

    14 avril 2024, par Leo-Mahendra

    i cant send the video from webrtc which is converted to bufferd data for every 10seconds and send to server.js where it takes it via websockets and convert it to flv format using ffmpeg.

    


    i am trying to send it to rtmp server named restreamer for start, here i tried to convert the buffer data and send it to rtmp link using ffmpeg commands, where i initially started to suceesfully save the file from webrtc to mp4 format for a duration of 2-3 minute.

    


    after i tried to use webrtc to send video data for every 10 seconds and in server i tried to send it to rtmp but i cant send it, but i can see the connection of rtmp url and server is been taken place but i cant see the video i can see the logs in rtmp server as

    


    2024-04-14 12:35:45 ts=2024-04-14T07:05:45Z level=INFO component="RTMP" msg="no streams available" action="INVALID" address=":1935" client="172.17.0.1:37700" path="/3d30c5a9-2059-4843-8957-da963c7bc19b.stream" who="PUBLISH"
2024-04-14 12:35:45 ts=2024-04-14T07:05:45Z level=INFO component="RTMP" msg="no streams available" action="INVALID" address=":1935" client="172.17.0.1:37716" path="/3d30c5a9-2059-4843-8957-da963c7bc19b.stream" who="PUBLISH"
2024-04-14 12:35:45 ts=2024-04-14T07:05:45Z level=INFO component="RTMP" msg="no streams available" action="INVALID" address=":1935" client="172.17.0.1:37728" path="/3d30c5a9-2059-4843-8957-da963c7bc19b.stream" who="PUBLISH"   


    


    my frontend code

    


         const handleSendVideo = async () => {
        console.log("start");
    
        if (!ws) {
            console.error('WebSocket connection not established.');
            return;
        }
    
        try {
            const videoStream = await navigator.mediaDevices.getUserMedia({ video: true });
            const mediaRecorder = new MediaRecorder(videoStream);
    
            const requiredFrameSize = 460800;
            const frameDuration = 10 * 1000; // 10 seconds in milliseconds
    
            mediaRecorder.ondataavailable = async (event) => {
                if (ws.readyState !== WebSocket.OPEN) {
                    console.error('WebSocket connection is not open.');
                    return;
                }
    
                if (event.data.size > 0) {
                    const arrayBuffer = await event.data.arrayBuffer();
                    const uint8Array = new Uint8Array(arrayBuffer);
    
                    const width = videoStream.getVideoTracks()[0].getSettings().width;
                    const height = videoStream.getVideoTracks()[0].getSettings().height;
    
                    const numFrames = Math.ceil(uint8Array.length / requiredFrameSize);
    
                    for (let i = 0; i < numFrames; i++) {
                        const start = i * requiredFrameSize;
                        const end = Math.min((i + 1) * requiredFrameSize, uint8Array.length);
                        let frameData = uint8Array.subarray(start, end);
    
                        // Pad or trim the frameData to match the required size
                        if (frameData.length < requiredFrameSize) {
                            // Pad with zeros to reach the required size
                            const paddedData = new Uint8Array(requiredFrameSize);
                            paddedData.set(frameData, 0);
                            frameData = paddedData;
                        } else if (frameData.length > requiredFrameSize) {
                            // Trim to match the required size
                            frameData = frameData.subarray(0, requiredFrameSize);
                        }
    
                        const dataToSend = {
                            buffer: Array.from(frameData), // Convert Uint8Array to array of numbers
                            width: width,
                            height: height,
                            pixelFormat: 'yuv420p',
                            mode: 'SendRtmp'
                        };
    
                        console.log("Sending frame:", i);
                        ws.send(JSON.stringify(dataToSend));
                    }
                }
            };
    
            // Start recording and send data every 10 seconds
            mediaRecorder.start(frameDuration);
    
            console.log("MediaRecorder started.");
        } catch (error) {
            console.error('Error accessing media devices or starting recorder:', error);
        }
      };


    


    and my backend

    


        wss.on('connection', (ws) => {
    console.log('WebSocket connection established.');

    ws.on('message', async (data) => {
        try {
            const parsedData = JSON.parse(data);

            if (parsedData.mode === 'SendRtmp' && Array.isArray(parsedData.buffer)) {
                const { buffer, pixelFormat, width, height } = parsedData;
                const bufferArray = Buffer.from(buffer);

                await sendRtmpVideo(bufferArray, pixelFormat, width, height);
            } else {
                console.log('Received unknown or invalid mode or buffer data');
            }
        } catch (error) {
            console.error('Error parsing WebSocket message:', error);
        }
    });

    ws.on('close', () => {
        console.log('WebSocket connection closed.');
    });
    });
    const sendRtmpVideo = async (frameBuffer, pixelFormat, width, height) => {
    console.log("ffmpeg data",frameBuffer)
    try {
        const ratio = `${width}x${height}`;
        const ffmpegCommand = [
            '-re',
            '-f', 'rawvideo',
            '-pix_fmt', pixelFormat,
            '-s', ratio,
            '-i', 'pipe:0',
            '-c:v', 'libx264',
            '-preset', 'fast', // Specify the preset for libx264
            '-b:v', '3000k',    // Specify the video bitrate
            '-loglevel', 'debug',
            '-f', 'flv',
            // '-flvflags', 'no_duration_filesize', 
            RTMPLINK
        ];


        const ffmpeg = spawn('ffmpeg', ffmpegCommand);

        ffmpeg.on('exit', (code, signal) => {
            if (code === 0) {
                console.log('FFmpeg process exited successfully.');
            } else {
                console.error(`FFmpeg process exited with code ${code} and signal ${signal}`);
            }
        });

        ffmpeg.on('error', (error) => {
            console.error('FFmpeg spawn error:', error);
        });

        ffmpeg.stderr.on('data', (data) => {
            console.error(`FFmpeg stderr: ${data}`);
        });

        ffmpeg.stdin.write(frameBuffer, (err) => {
            if (err) {
                console.error('Error writing to FFmpeg stdin:', err);
            } else {
                console.log('Data written to FFmpeg stdin successfully.');
            }
            ffmpeg.stdin.end(); // Close stdin after writing the buffer
        });
        } catch (error) {
        console.error('Error in sendRtmpVideo:', error);
        }
    };



    


  • Flutter error in Ffmpeg, "Unhandled Exception : ProcessException : No such file or directory" in macOS desktop version

    19 avril 2024, par pratik vekariya

    I'm trying video trim video using ffmpeg, for macOS desktop application.

    


    I have downloaded ffmpeg from here for macOS.

    


    Here is my code

    


        String mainPath = &#x27;Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/&#x27;;&#xA;        mainPath = mainPath.substring(0, mainPath.lastIndexOf("/"));&#xA;    &#xA;                  Directory directoryExe3 = Directory("$mainPath");&#xA;                  var dbPath = path.join(directoryExe3.path,&#xA;                      "App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos");&#xA;//here in "Products/Debug/" folder desktop app will generate&#xA;&#xA;//directoryExe3 path will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug&#xA;&#xA;//and dbPath will be, Users/apple/Workspace/User/2024/Project/videoapp/build/macos/Build/Products/Debug/App.framework/Resources/flutter_assets/assets/ffmpeg/ffmpegmacos&#xA;&#xA;//so when app will run it can access it from this path&#xA;&#xA;//executable code, command for ffmpeg&#xA;&#xA;String transpose_str &#x2B;= "crop=" &#x2B;&#xA;              out_w.toInt().toString() &#x2B;&#xA;              ":" &#x2B;&#xA;              out_h.toInt().toString() &#x2B;&#xA;              ":" &#x2B;&#xA;              x!.toInt().toString() &#x2B;&#xA;              ":" &#x2B;&#xA;              y!.toInt().toString() &#x2B;&#xA;              ",";&#xA;          transpose_str &#x2B;= "scale=960:192";&#xA;&#xA;Future<processresult> result_ = Process.run(dbPath, [&#xA;                "-ss",&#xA;                timestamp,&#xA;                "-i",&#xA;                inputFilePath,&#xA;                "-t",&#xA;                endTime,&#xA;                "-vf",&#xA;                transpose_str,&#xA;                "-an",&#xA;                "./temp.mp4",&#xA;              ]); &#xA;</processresult>

    &#xA;

    Now when I run this in macOS desktop verison, it gives me error at Process.run that in dbPath, Unhandled Exception : ProcessException : No such file or directory.

    &#xA;

    Any help would be appreciate !

    &#xA;

    when i run this as desktop version it should get file from assets.

    &#xA;

  • java.io.IOException : Cannot run program "/data/user/0/com.voi.myapplication8/files/ffmpeg" : error=13, Permission denied

    1er avril 2024, par Harsha
    &#xA;

    java.io.IOException : Cannot run program&#xA;"/data/user/0/com.voi.myapplication8/files/ffmpeg" : error=13,&#xA;Permission denied

    &#xA;

    &#xA;

    I am using this dependencies&#xA;implementation 'com.writingminds:FFmpegAndroid:0.3.2'

    &#xA;

    &#xA;

    2024-03-31 21:40:31.045 15937-16762 FFmpeg
    &#xA;com.voi.myapplication8 E Exception while trying to run :&#xA;[Ljava.lang.String ;@71d4c0f&#xA;java.io.IOException : Cannot run program&#xA;"/data/user/0/com.voi.myapplication8/files/ffmpeg" : error=13,&#xA;Permission denied&#xA;at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050)&#xA;at java.lang.Runtime.exec(Runtime.java:712)&#xA;at java.lang.Runtime.exec(Runtime.java:571)&#xA;at&#xA;com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)&#xA;at&#xA;com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)&#xA;at&#xA;com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)&#xA;at android.os.AsyncTask$3.call(AsyncTask.java:394)&#xA;at java.util.concurrent.FutureTask.run(FutureTask.java:264)&#xA;at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)&#xA;at&#xA;java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)&#xA;at&#xA;java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)&#xA;at java.lang.Thread.run(Thread.java:1012)&#xA;Caused by : java.io.IOException : error=13, Permission denied&#xA;at java.lang.UNIXProcess.forkAndExec(Native Method)&#xA;at java.lang.UNIXProcess.(UNIXProcess.java:133)&#xA;at java.lang.ProcessImpl.start(ProcessImpl.java:141)&#xA;at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)&#xA;at java.lang.Runtime.exec(Runtime.java:712) &#xA;at java.lang.Runtime.exec(Runtime.java:571) &#xA;at&#xA;com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10) &#xA;at&#xA;com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38) &#xA;at&#xA;com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10) &#xA;at android.os.AsyncTask$3.call(AsyncTask.java:394) &#xA;at java.util.concurrent.FutureTask.run(FutureTask.java:264) &#xA;at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) &#xA;at&#xA;java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) &#xA;at&#xA;java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) &#xA;at java.lang.Thread.run(Thread.java:1012)  2024-03-31 21:40:31.045&#xA;15937-15937 FFmpeg com.voi.myapplication8
    &#xA;E Video cropping failed :

    &#xA;

    &#xA;