Advanced search

Medias (91)

Other articles (31)

  • MediaSPIP Core : La Configuration

    9 November 2010, by

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes; une page spécifique à la configuration de la page d’accueil du site; une page spécifique à la configuration des secteurs;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques de (...)

  • Creating farms of unique websites

    13 April 2011, by

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things): implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 September 2013, by

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo; l’ajout d’une bannière l’ajout d’une image de fond;

On other websites (8251)

  • FFMPEG ERROR on streaming video generated from MediaRecorder API on RTMP url

    20 February 2024, by Prince Mishra

    Ref : https://www.mux.com/blog/the-state-of-going-live-from-a-browser

    


    The above blog states my problem in detail and presented a solution also.
I am trying to implement the solution which is using socketio

    


    Here is the description of the problem :

    


    I want to capture the video and audio from the browser using

    


    navigator.mediaDevices
    .getUserMedia({ video: true, audio: true })


    


    and i am using the

    


    const options = {
    mimeType: "video/webm;codecs=vp8",
};
const mediaRecorder = new MediaRecorder(stream, options);


    


    to record the video chunk by chunk from the stream given by getusermedia and then using the socket io to send the video to the backend. Where I am using the ffmpeg to stream the chunks on rtmp url.

    


    I am using the following ffmpeg commands :

    


    const { spawn } = require('child_process');

const ffmpegProcess = spawn('ffmpeg', [
    '-i', 'pipe:0',
    '-c:v', 'libx264',
    '-preset', 'veryfast',
    '-tune', 'zerolatency',
    '-c:a', 'aac',
    '-ar', '44100',
    '-f', 'flv',
    rtmpurl
]);


    


    And I am getting the following errors:

    


    Error Image 1

    


    Error Image 2

    


    Error Image 3

    


    Can anyone help me how to fix this. I am new to FFmpeg.

    


    Here is the complete frontend and Backend code :

    


    Frontend (App.jsx) :


    


    import { useEffect } from "react";&#xA;import "./App.css";&#xA;import io from "socket.io-client";&#xA;&#xA;function App() {&#xA;  let video;&#xA;&#xA;  useEffect(() => {&#xA;    video = document.getElementById("video");&#xA;  }, []);&#xA;&#xA;  const socket = io("http://localhost:3050");&#xA;  socket.on("connect", () => {&#xA;    console.log("Connected to server");&#xA;  });&#xA;&#xA;  let stream;&#xA;  navigator.mediaDevices&#xA;    .getUserMedia({ video: true, audio: true })&#xA;    .then((strea) => {&#xA;      video.srcObject = strea;&#xA;      stream = strea;&#xA;      const options = {&#xA;        mimeType: "video/webm;codecs=vp8",&#xA;      };&#xA;      const mediaRecorder = new MediaRecorder(stream, options);&#xA;      console.log(mediaRecorder);&#xA;      let chunks = [];&#xA;&#xA;      mediaRecorder.ondataavailable = function (e) {&#xA;        chunks.push(e.data);&#xA;        console.log(e.data);&#xA;      };&#xA;      mediaRecorder.onstop = function (e) {&#xA;        const blob = new Blob(chunks, { type: "video/webm;codecs=vp8" });&#xA;        console.log("emitted");&#xA;        socket.emit("videoChunk", blob);&#xA;        chunks = [];&#xA;        // const videoURL = URL.createObjectURL(blob);&#xA;        // const a = document.createElement(&#x27;a&#x27;);&#xA;        // a.href = videoURL;&#xA;        // a.download = &#x27;video.mp4&#x27;;&#xA;        // a.click();&#xA;        window.URL.revokeObjectURL(videoURL);&#xA;      };&#xA;      mediaRecorder.start();&#xA;      setInterval(() => {&#xA;        mediaRecorder.stop();&#xA;        mediaRecorder.start();&#xA;      }, 2000);&#xA;    })&#xA;    .catch((error) => {&#xA;      console.error("Error accessing camera:", error);&#xA;    });&#xA;&#xA;  // Capture video after 10 seconds&#xA;&#xA;  return (&#xA;    &lt;>&#xA;      <video width="640" height="480" autoplay="autoplay"></video>&#xA;      <button>Capture</button>&#xA;    >&#xA;  );&#xA;}&#xA;&#xA;export default App;&#xA;

    &#xA;

    Backend Code :

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const http = require(&#x27;http&#x27;);&#xA;const socketIo = require(&#x27;socket.io&#x27;);&#xA;const { spawn } = require(&#x27;child_process&#x27;);&#xA;&#xA;const app = express();&#xA;&#xA;const server = http.createServer(app);&#xA;const io = socketIo(server, {&#xA;    cors: {&#xA;      origin: "*",&#xA;      methods: ["GET", "POST"]&#xA;    }, maxhttpBufferSize: 1e8&#xA;  });&#xA;&#xA;  const rtmpurl = &#x27;rtmp://localhost/live/test&#x27;;&#xA;&#xA;io.on(&#x27;connection&#x27;, (socket) => {&#xA;    console.log(&#x27;A user connected&#x27;);&#xA;&#xA;    const ffmpegProcess = spawn(&#x27;ffmpeg&#x27;, [&#xA;        &#x27;-i&#x27;, &#x27;pipe:0&#x27;,&#xA;        &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;        &#x27;-preset&#x27;, &#x27;veryfast&#x27;,&#xA;        &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,&#xA;        &#x27;-c:a&#x27;, &#x27;aac&#x27;,&#xA;        &#x27;-ar&#x27;, &#x27;44100&#x27;,&#xA;        &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;        rtmpurl&#xA;    ]);&#xA;&#xA;&#xA;    ffmpegProcess.stdin.on(&#x27;error&#x27;, (e) => {&#xA;        console.log(e);&#xA;    });&#xA;    &#xA;    ffmpegProcess.stderr.on(&#x27;data&#x27;, (data) => {&#xA;        console.log(data.toString());&#xA;    });&#xA;&#xA;    ffmpegProcess.on(&#x27;close&#x27;, (code) => {&#xA;        console.log(`child process exited with code ${code}`);&#xA;    });&#xA;&#xA;&#xA;    socket.on(&#x27;videoChunk&#x27;, (chunk) => {&#xA;        console.log(chunk)&#xA;        ffmpegProcess.stdin.write(chunk);&#xA;&#xA;    });&#xA;&#xA;    socket.on(&#x27;disconnect&#x27;, () => {&#xA;        console.log(&#x27;User disconnected&#x27;);&#xA;        ffmpegProcess.stdin.end();&#xA;    });&#xA;});&#xA;&#xA;const PORT = process.env.PORT || 3050;&#xA;&#xA;app.get(&#x27;/test&#x27;, (req, res) => {&#xA;    res.send(&#x27;Hello from /test route!&#x27;);&#xA;});&#xA;&#xA;&#xA;server.listen(PORT, () => {&#xA;    console.log(`Server is running on port ${PORT}`);&#xA;});&#xA;

    &#xA;

  • Error compiling and building DashEncoder code and how to play the .mpd file when generated [closed]

    11 April 2013, by niuu

    I'm trying to build the DashEncoder code which I downloaded from github https://github.com/slederer/DASHEncoder. Well, I followed all the instructions given in the how to compile dash file. installed Gpac n X264 and compiled both successfully. Then did make of Dashencoder and ran it as ./Dashencoder. But I found some issues in it. Got this log :

    ==========DASH ENCODER===============
    Unknown option in resourcefile : sql-pw :
    current encoder x264
    YES
    x264 encoding @ 300 kbps: Pass 1
    x264: x264 —profile baseline —preset slow —verbose —fps 24 —vbv-maxrate 300 —vbv-bufsize 600 —scenecut 0 —keyint 48 —output /opt/lampp/htdocs/tests_updates/sintel_trailer_2k_480p24_300kbit.h264 /home/niu/sintel_trailer_2k_480p24.y4m >out.txt 2>&1
    mkdir: cannot create directory

    /opt/lampp/htdocs/tests_updates/sintel_300kbit&#39;: File exists
    cp: omitting directory

    /opt/lampp/htdocs/tests_updates/'
    copy audio: cp /opt/lampp/htdocs/tests_updates/ /opt/lampp/htdocs/tests_updates/sintel_300kbit/MP4Box multiplexing Video: /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.h264
    mp4box: MP4Box -add /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.h264 /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4
    AVC-H264 import - frame size 854 x 480 at 24.000 FPS
    AVC Import results: 1253 samples - Slices: 27 I 1226 P 0 B - 1 SEI - 27 IDR
    Saving to /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4: 0.500 secs Interleaving
    MP4Box multiplexing Audio:/opt/lampp/htdocs/tests_updates/sintel_300kbit/
    mp4box: MP4Box -add /opt/lampp/htdocs/tests_updates/sintel_300kbit/ /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4
    Unknown input file type
    Unknown input file type
    Error importing /opt/lampp/htdocs/tests_updates/sintel_300kbit/: Bad Parameter
    MP4Box Cleaning ...
    mp4box: MP4Box -no-sys /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4
    Saving /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4: 0.500 secs Interleaving
    MP4Box segmentation: /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.h264
    mp4box: MP4Box -frag 2000 -dash 2000 -rap -segment-name /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4
    DASH-ing file: 2.00s segments 2.00s fragments single sidx per segment
    Spliting segments at GOP boundaries
    [DASH] Generating MPD at time 2013-03-16T16:40:03Z
    DASHing file /opt/lampp/htdocs/tests_updates/sintel_300kbit/sintel_trailer_2k_480p24_300kbit.mp4
    terminate called after throwing an instance of 'std::out_of_range'
    what(): basic_string::substr
    Error: Unable to open MPD file!Aborted
    Why is this error at the end? and also one folder got created in my /opt/lampp/htdocs/tests_updates/sintel_300kbit. which has two types of files : 27 files of .m4s extension 1 file -sintelinit.mp4 1 file- sintel_trailer_2k_480p24_300kbit.mp4 , which when played in vlc player played the video bt no audio! &

    1 file- sintel_trailer_2k_480p24_300kbit.h264 which cannot be opened.

    No .mpd file was created.

    Also I want to know aft creating that .mpd file how will i be able to test it on my android client say media player.

    I am damn confused with all this happening. Please help

  • cap.isOpened(): returns false in CentOS for Python 3 and OpenCV 3.1.0

    29 October 2017, by Mona Jalal

    So cap from opencv 3 doesn’t work in CentOS. I had no problem in OSX or Windows 7 which I tried initially.
    Here is the example code:

    import cv2
    cap = cv2.VideoCapture('/home/grad3/jalal/PycharmProjects/hw4_cs58‌​5/Concession_LAN_8‌​‌​00‌​k.mp4',cv2.CAP_FFMPEG)

    if not cap.isOpened():
       print('not opened')

    while True:
       ret,frame = cap.read()

       if ret == False:
           print('frame empty')
           break
       cv2.imshow('frame', frame)
       if cv2.waitKey(1) == ord('q'):
           break

    And I get:

    /usr/local/anaconda3/bin/python /home/grad3/jalal/PycharmProjects/hw4_cs585/test.py
    not opened
    frame empty

    Process finished with exit code 0

    I can open the video using ffplay vid_name and also here is the result of https://pastebin.com/YGk2DDCi here https://pastebin.com/HSyHSsEZ (ffmpeg codecs). How should I fix this?

    I have opencv 3.1.0 and here’s some sys info.

    $ uname -a
    Linux goku.bu.edu 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

    and

    $ lsb_release -a
    LSB Version:    :core-4.1-amd64:core-4.1-noarch
    Distributor ID: CentOS
    Description:    CentOS Linux release 7.4.1708 (Core)
    Release:    7.4.1708
    Codename:   Core

    cv2. getBuildInformation()
    General configuration for OpenCV 3.1.0 =====================================
     Version control:               unknown

     Platform:
       Host:                        Linux 4.8.0-46-generic x86_64
       CMake:                       3.6.3
       CMake generator:             Unix Makefiles
       CMake build tool:            /usr/bin/gmake
       Configuration:               Release

     C/C++:
       Built as dynamic libs?:      YES
       C++ Compiler:                /opt/rh/devtoolset-2/root/usr/bin/c++  (ver 4.8.2)
       C++ flags (Release):         -I/cs/software/anaconda3/include    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
       C++ flags (Debug):           -I/cs/software/anaconda3/include    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
       C Compiler:                  /opt/rh/devtoolset-2/root/usr/bin/cc
       C flags (Release):           -I/cs/software/anaconda3/include    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
       C flags (Debug):             -I/cs/software/anaconda3/include    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
       Linker flags (Release):
       Linker flags (Debug):
       Precompiled headers:         YES
       Extra dependencies:          /cs/software/anaconda3/lib/libjpeg.so /cs/software/anaconda3/lib/libpng.so /cs/software/anaconda3/lib/libtiff.so /cs/software/anaconda3/lib/libhdf5.so /usr/lib64/librt.so /usr/lib64/libpthread.so /cs/software/anaconda3/lib/libz.so /usr/lib64/libdl.so /usr/lib64/libm.so dl m pthread rt
       3rdparty dependencies:       libwebp libjasper IlmImf libprotobuf

     OpenCV modules:
       To be built:                 core flann hdf imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python3
       Disabled:                    world contrib_world
       Disabled by dependency:      -
       Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz cvv matlab sfm

     GUI:
       QT:                          NO
       GTK+:                        NO
       GThread :                    NO
       GtkGlExt:                    NO
       OpenGL support:              NO
       VTK support:                 NO

     Media I/O:
       ZLib:                        /cs/software/anaconda3/lib/libz.so (ver 1.2.8)
       JPEG:                        /cs/software/anaconda3/lib/libjpeg.so (ver 80)
       WEBP:                        build (ver 0.3.1)
       PNG:                         /cs/software/anaconda3/lib/libpng.so (ver 1.6.27)
       TIFF:                        /cs/software/anaconda3/lib/libtiff.so (ver 42 - 4.0.6)
       JPEG 2000:                   build (ver 1.900.1)
       OpenEXR:                     build (ver 1.7.1)
       GDAL:                        NO

     Video I/O:
       DC1394 1.x:                  NO
       DC1394 2.x:                  NO
       FFMPEG:                      NO
         codec:                     NO
         format:                    NO
         util:                      NO
         swscale:                   NO
         resample:                  NO
         gentoo-style:              NO
       GStreamer:                   NO
       OpenNI:                      NO
       OpenNI PrimeSensor Modules:  NO
       OpenNI2:                     NO
       PvAPI:                       NO
       GigEVisionSDK:               NO
       UniCap:                      NO
       UniCap ucil:                 NO
       V4L/V4L2:                    YES/YES
       XIMEA:                       NO
       Xine:                        NO
       gPhoto2:                     NO

     Parallel framework:            OpenMP

     Other third-party libraries:
       Use IPP:                     9.0.1 [9.0.1]
            at:                     /opt/conda/conda-bld/opencv_1491943704081/work/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
       Use IPP Async:               NO
       Use VA:                      NO
       Use Intel VA-API/OpenCL:     NO
       Use Eigen:                   YES (ver 3.2.8)
       Use Cuda:                    NO
       Use OpenCL:                  NO
       Use custom HAL:              NO

     Python 2:
       Interpreter:                 (ver 3.5.3)

     Python 3:
       Interpreter:                 /cs/software/anaconda3/bin/python (ver 3.5.3)
       Libraries:                   /cs/software/anaconda3/lib/libpython3.5m.so (ver 3.5.3)
       numpy:                       /cs/software/anaconda3/lib/python3.5/site-packages/numpy/core/include (ver 1.12.1)
       packages path:               /cs/software/anaconda3/lib/python3.5/site-packages

     Python (for build):            

     Java:
       ant:                         NO
       JNI:                         NO
       Java wrappers:               NO
       Java tests:                  NO

     Matlab:                        NO

     Tests and samples:
       Tests:                       NO
       Performance tests:           NO
       C/C++ Examples:              NO

     Install path:                  /cs/software/anaconda3

     cvconfig.h is in:              /opt/conda/conda-bld/opencv_1491943704081/work/opencv-3.1.0/build
    -----------------------------------------------------------------

    UPDATE: tried .avi and .flv formats and the same problem!