Recherche avancée

Médias (0)

Mot : - Tags -/objet éditorial

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (81)

  • 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 (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • La gestion des forums

    3 novembre 2011, par

    Si les forums sont activés sur le site, les administrateurs ont la possibilité de les gérer depuis l’interface d’administration ou depuis l’article même dans le bloc de modification de l’article qui se trouve dans la navigation de la page.
    Accès à l’interface de modération des messages
    Lorsqu’il est identifié sur le site, l’administrateur peut procéder de deux manières pour gérer les forums.
    S’il souhaite modifier (modérer, déclarer comme SPAM un message) les forums d’un article particulier, il a à sa (...)

Sur d’autres sites (3487)

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

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

    &#xA;

    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.

    &#xA;

    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

    &#xA;

    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"&#xA;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"&#xA;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"   &#xA;

    &#xA;

    my frontend code

    &#xA;

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

    &#xA;

    and my backend

    &#xA;

        wss.on(&#x27;connection&#x27;, (ws) => {&#xA;    console.log(&#x27;WebSocket connection established.&#x27;);&#xA;&#xA;    ws.on(&#x27;message&#x27;, async (data) => {&#xA;        try {&#xA;            const parsedData = JSON.parse(data);&#xA;&#xA;            if (parsedData.mode === &#x27;SendRtmp&#x27; &amp;&amp; Array.isArray(parsedData.buffer)) {&#xA;                const { buffer, pixelFormat, width, height } = parsedData;&#xA;                const bufferArray = Buffer.from(buffer);&#xA;&#xA;                await sendRtmpVideo(bufferArray, pixelFormat, width, height);&#xA;            } else {&#xA;                console.log(&#x27;Received unknown or invalid mode or buffer data&#x27;);&#xA;            }&#xA;        } catch (error) {&#xA;            console.error(&#x27;Error parsing WebSocket message:&#x27;, error);&#xA;        }&#xA;    });&#xA;&#xA;    ws.on(&#x27;close&#x27;, () => {&#xA;        console.log(&#x27;WebSocket connection closed.&#x27;);&#xA;    });&#xA;    });&#xA;    const sendRtmpVideo = async (frameBuffer, pixelFormat, width, height) => {&#xA;    console.log("ffmpeg data",frameBuffer)&#xA;    try {&#xA;        const ratio = `${width}x${height}`;&#xA;        const ffmpegCommand = [&#xA;            &#x27;-re&#x27;,&#xA;            &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#xA;            &#x27;-pix_fmt&#x27;, pixelFormat,&#xA;            &#x27;-s&#x27;, ratio,&#xA;            &#x27;-i&#x27;, &#x27;pipe:0&#x27;,&#xA;            &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;            &#x27;-preset&#x27;, &#x27;fast&#x27;, // Specify the preset for libx264&#xA;            &#x27;-b:v&#x27;, &#x27;3000k&#x27;,    // Specify the video bitrate&#xA;            &#x27;-loglevel&#x27;, &#x27;debug&#x27;,&#xA;            &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;            // &#x27;-flvflags&#x27;, &#x27;no_duration_filesize&#x27;, &#xA;            RTMPLINK&#xA;        ];&#xA;&#xA;&#xA;        const ffmpeg = spawn(&#x27;ffmpeg&#x27;, ffmpegCommand);&#xA;&#xA;        ffmpeg.on(&#x27;exit&#x27;, (code, signal) => {&#xA;            if (code === 0) {&#xA;                console.log(&#x27;FFmpeg process exited successfully.&#x27;);&#xA;            } else {&#xA;                console.error(`FFmpeg process exited with code ${code} and signal ${signal}`);&#xA;            }&#xA;        });&#xA;&#xA;        ffmpeg.on(&#x27;error&#x27;, (error) => {&#xA;            console.error(&#x27;FFmpeg spawn error:&#x27;, error);&#xA;        });&#xA;&#xA;        ffmpeg.stderr.on(&#x27;data&#x27;, (data) => {&#xA;            console.error(`FFmpeg stderr: ${data}`);&#xA;        });&#xA;&#xA;        ffmpeg.stdin.write(frameBuffer, (err) => {&#xA;            if (err) {&#xA;                console.error(&#x27;Error writing to FFmpeg stdin:&#x27;, err);&#xA;            } else {&#xA;                console.log(&#x27;Data written to FFmpeg stdin successfully.&#x27;);&#xA;            }&#xA;            ffmpeg.stdin.end(); // Close stdin after writing the buffer&#xA;        });&#xA;        } catch (error) {&#xA;        console.error(&#x27;Error in sendRtmpVideo:&#x27;, error);&#xA;        }&#xA;    };&#xA;&#xA;

    &#xA;

  • ffmpeg output with label 'v' does not exist in any defined filtler graph

    15 avril 2024, par David Royale

    Been trying to make this Python code work but it fails up until rendering the final part :

    &#xA;

    import subprocess&#xA;import re&#xA;import os&#xA;&#xA;def detect_idle_sections(video_path):&#xA;    command = [&#x27;ffmpeg&#x27;, &#x27;-i&#x27;, video_path, &#x27;-vf&#x27;, &#x27;select=\&#x27;gt(scene,0.1)\&#x27;&#x27;, &#x27;-vsync&#x27;, &#x27;vfr&#x27;, &#x27;-f&#x27;, &#x27;null&#x27;, &#x27;-&#x27;]&#xA;    output = subprocess.check_output(command, stderr=subprocess.STDOUT).decode(&#x27;utf-8&#x27;)&#xA;    &#xA;    idle_sections = []&#xA;    duration = 0.0&#xA;    for line in output.split(&#x27;\n&#x27;):&#xA;        match = re.search(r&#x27;scene:(\d&#x2B;)&#x27;, line)&#xA;        if match:&#xA;            scene = int(match.group(1))&#xA;            if scene == 0:&#xA;                duration &#x2B;= 1.0 / 30  # Assuming 30 fps&#xA;            else:&#xA;                if duration > 0:&#xA;                    idle_sections.append((duration, duration - (1.0 / 30)))  # Duration and start time&#xA;                    duration = 0.0&#xA;    &#xA;    return idle_sections&#xA;&#xA;def cut_idle_sections(video_path, idle_sections, output_path, total_duration):&#xA;    print("starting to cut things")&#xA;    filters = []&#xA;    start_time = 0.0&#xA;    for duration, _ in idle_sections:&#xA;        filters.append(f&#x27;[0:v]trim=start={start_time}:end={start_time &#x2B; duration},setpts=PTS-STARTPTS[v{len(filters)}]&#x27;)&#xA;        start_time &#x2B;= duration&#xA;    &#xA;    if start_time &lt; total_duration:&#xA;        filters.append(f&#x27;[0:v]trim=start={start_time},setpts=PTS-STARTPTS[v{len(filters)}]&#x27;)&#xA;&#xA;    filter_str = &#x27;;&#x27;.join(filters)&#xA;    print("finished chopping")&#xA;    command = [&#x27;ffmpeg&#x27;, &#x27;-i&#x27;, video_path, &#x27;-filter_complex&#x27;, filter_str, &#x27;-map&#x27;, &#x27;[v]&#x27;, output_path]&#xA;    subprocess.call(command)&#xA;&#xA;def get_total_duration(video_path):&#xA;    print("prior getting time")&#xA;    command = [&#x27;ffprobe&#x27;, &#x27;-v&#x27;, &#x27;error&#x27;, &#x27;-show_entries&#x27;, &#x27;format=duration&#x27;, &#x27;-of&#x27;, &#x27;default=noprint_wrappers=1:nokey=1&#x27;, video_path]&#xA;    output = subprocess.check_output(command).decode(&#x27;utf-8&#x27;).strip()&#xA;    print("after getting time")&#xA;    return float(output)&#xA;&#xA;input_file = r"C:\Users\D\Videos\2024-04-15 08-42-53.mkv"&#xA;output_file = r"C:\Users\D\Videos\output_video.mp4"&#xA;&#xA;# Get full paths&#xA;input_path = os.path.abspath(input_file)&#xA;output_path = os.path.abspath(output_file)&#xA;&#xA;total_duration = get_total_duration(input_path)&#xA;idle_sections = detect_idle_sections(input_path)&#xA;cut_idle_sections(input_path, idle_sections, output_path, total_duration)&#xA;

    &#xA;

    The error I am getting is :

    &#xA;

    [out#0/mp4 @ 000001af60f9d3c0] Output with label &#x27;v&#x27; does not exist in any defined filter graph, or was already used elsewhere.&#xA;Error opening output file C:\Users\D_era\Videos\output_video.mp4.&#xA;Error opening output files: Invalid argument&#xA;

    &#xA;

    The code is intended to cut "iddle" frames where frame a = frame b. I want to point out that I don't really care about audio, so it's just comparing if frames "A" through "H" are the same and keeping a and continuing with the rest of the video.

    &#xA;

    Putting some comments to determine which part was successful and which broke, I found that the line failig is this :

    &#xA;

    command = [&#x27;ffmpeg&#x27;, &#x27;-i&#x27;, video_path, &#x27;-filter_complex&#x27;, filter_str, &#x27;-map&#x27;, &#x27;[v]&#x27;, output_path]&#xA;

    &#xA;

    and apparently is the -map part.

    &#xA;