Recherche avancée

Médias (91)

Autres articles (68)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (10178)

  • 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;

  • Apache Tika 2.0.9 programm ffmpeg and exiftool not found ?

    6 avril 2024, par mj44

    I use an JavaFX Maven Project to use Apache Tika Version 2.9.0.&#xA;The Java Test program will be finished and all methods that I create will done right.&#xA;I have in the log file a lot of DEBUG errors and Idon't know why ?&#xA;I habe spent many hours to clear the problem.

    &#xA;

    Here's an excerpt of the logfile

    &#xA;

    2024-04-03 14:56:12 [main] DEBUG org.apache.tika.parser.external.ExternalParser - exception trying to run  ffmpeg&#xA;java.io.IOException: Cannot run program "ffmpeg": CreateProcess error=2, Das System kann die angegebene Datei nicht finden&#xA;    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1140) ~[?:?]&#xA;    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1074) ~[?:?]&#xA;...&#xA;2024-04-03 14:56:12 [main] DEBUG org.apache.tika.parser.external.ExternalParser - exception trying to run  exiftool&#xA;java.io.IOException: Cannot run program "exiftool": CreateProcess error=2, Das System kann die angegebene Datei nicht finden&#xA;    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1140) ~[?:?]&#xA;    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1074) ~[?:?]&#xA;...&#xA;&#xA;

    &#xA;

    The message says that ffmpeg and exiftool are not found.

    &#xA;

    This is my tika-config.xml

    &#xA;

    &lt;?xml version="1.0" encoding="UTF-8"?>&#xA;<properties>&#xA;    <parsers>&#xA;        <parser class="org.apache.tika.parser.DefaultParser"></parser>&#xA;        <parser class="org.apache.tika.parser.pdf.PDFParser"></parser>&#xA;        &#xA;        <parser class="org.apache.tika.parser.external.ExternalParser">&#xA;            <params>&#xA;                true&#xA;                &#xA;                "D:\Tools\ffmpeg-6.1.1\bin\ffmpeg.exe"&#xA;            </params>&#xA;        </parser>&#xA;        &#xA;        <parser class="org.apache.tika.parser.external.ExternalParser">&#xA;            <params>&#xA;                true&#xA;                &#xA;                "D:\Tools\exiftool.exe"&#xA;            </params>&#xA;        </parser>&#xA;    </parsers>&#xA;    <detector>&#xA;        <detector class="org.apache.tika.detect.DefaultDetector"></detector>&#xA;    </detector>&#xA;</properties>&#xA;

    &#xA;

    I tested the path of the programms in a console ant it worked fine ?&#xA;I don't know what I can do now ?

    &#xA;

    Thanks for Help

    &#xA;

    I have downloaded new copies of the ffmpeg and exiftool and installed them.&#xA;I tested it in a console to run and both tools work fine.&#xA;I tested the permissions, no problems with permissions&#xA;I tested that the tika-config.xml will be loaded, it loaded.

    &#xA;