Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (81)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

  • Qu’est ce qu’un masque de formulaire

    13 juin 2013, par

    Un masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
    Chaque formulaire de publication d’objet peut donc être personnalisé.
    Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
    Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (5958)

  • Audio recorded with MediaRecorder on Chrome missing duration

    3 juin 2017, par suppp111

    I am recording audio (oga/vorbis) files with MediaRecorder. When I record these file through Chrome I get problems : I cannot edit the files on ffmpeg and when I try to play them on Firefox it says they are corrupt (they do play fine on Chrome though).

    Looking at their metadata on ffmpeg I get this :

    Input #0, matroska,webm, from '91.oga':
     Metadata:
       encoder         : Chrome
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
    [STREAM]
    index=0
    codec_name=opus
    codec_long_name=Opus (Opus Interactive Audio Codec)
    profile=unknown
    codec_type=audio
    codec_time_base=1/48000
    codec_tag_string=[0][0][0][0]
    codec_tag=0x0000
    sample_fmt=fltp
    sample_rate=48000
    channels=1
    channel_layout=mono
    bits_per_sample=0
    id=N/A
    r_frame_rate=0/0
    avg_frame_rate=0/0
    time_base=1/1000
    start_pts=0
    start_time=0.000000
    duration_ts=N/A
    duration=N/A
    bit_rate=N/A
    max_bit_rate=N/A
    bits_per_raw_sample=N/A
    nb_frames=N/A
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    TAG:language=eng
    [/STREAM]
    [FORMAT]
    filename=91.oga
    nb_streams=1
    nb_programs=0
    format_name=matroska,webm
    format_long_name=Matroska / WebM
    start_time=0.000000
    duration=N/A
    size=7195
    bit_rate=N/A
    probe_score=100
    TAG:encoder=Chrome

    As you can see there are problems with the duration. I have looked at posts like this :
    How can I add predefined length to audio recorded from MediaRecorder in Chrome ?

    But even trying that, I got errors when trying to chop and merge files.For example when running :

    ffmpeg -f concat  -i 89_inputs.txt -c copy final.oga

    I get a lot of this :

    [oga @ 00000000006789c0] Non-monotonous DTS in output stream 0:0; previous: 57612, current: 1980; changing to 57613. This may result in incorrect timestamps in the output file.
    [oga @ 00000000006789c0] Non-monotonous DTS in output stream 0:0; previous: 57613, current: 2041; changing to 57614. This may result in incorrect timestamps in the output file.
    DTS -442721849179034176, next:42521 st:0 invalid dropping
    PTS -442721849179034176, next:42521 invalid dropping st:0
    [oga @ 00000000006789c0] Non-monotonous DTS in output stream 0:0; previous: 57614, current: 2041; changing to 57615. This may result in incorrect timestamps in the output file.
    [oga @ 00000000006789c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    DTS -442721849179031296, next:42521 st:0 invalid dropping
    PTS -442721849179031296, next:42521 invalid dropping st:0

    Does anyone know what we need to do to audio files recorded from Chrome for them to be useful ? Or is there a problem with my setup ?

    Recorder js :

    if (navigator.getUserMedia) {
     console.log('getUserMedia supported.');

     var constraints = { audio: true };
     var chunks = [];

     var onSuccess = function(stream) {
       var mediaRecorder = new MediaRecorder(stream);

       record.onclick = function() {
         mediaRecorder.start();
         console.log(mediaRecorder.state);
         console.log("recorder started");
         record.style.background = "red";

         stop.disabled = false;
         record.disabled = true;

         var aud = document.getElementById("audioClip");
         start = aud.currentTime;
       }

       stop.onclick = function() {
         console.log(mediaRecorder.state);
         console.log("Recording request sent.");
         mediaRecorder.stop();
       }

       mediaRecorder.onstop = function(e) {
         console.log("data available after MediaRecorder.stop() called.");

         var audio = document.createElement('audio');
         audio.setAttribute('controls', '');
         audio.setAttribute('id', 'audioClip');

         audio.controls = true;
         var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs="vorbis"' });
         chunks = [];
         var audioURL = window.URL.createObjectURL(blob);
         audio.src = audioURL;

         sendRecToPost(blob);   // this just send the audio blob to the server by post
         console.log("recorder stopped");

       }
  • TypeError : _ffmpeg_ffmpeg__WEBPACK_IMPORTED_MODULE_1__ is not a constructor

    10 novembre 2023, par Shubham
    import { useState, useRef } from "react";&#xA;&#xA;import \* as FFmpeg from "@ffmpeg/ffmpeg";&#xA;&#xA;const AudioRecorders = ({ onAudioRecorded }) =\> {&#xA;const \[permission, setPermission\] = useState(false);&#xA;const \[stream, setStream\] = useState(null);&#xA;const mimeType = "video/webm";&#xA;const mediaRecorder = useRef(null);&#xA;const \[recordingStatus, setRecordingStatus\] = useState("inactive");&#xA;const \[audioChunks, setAudioChunks\] = useState(\[\]);&#xA;const \[audio, setAudio\] = useState(null);&#xA;&#xA;const ffmpeg = useRef(null);&#xA;&#xA;const createFFmpeg = async ({ log = false }) =\> {&#xA;// here I am facing the error&#xA;const ffmpegInstance = new FFmpeg({ log });&#xA;await ffmpegInstance.load();&#xA;return ffmpegInstance;&#xA;};&#xA;&#xA;const convertWebmToWav = async (webmBlob) =\> {&#xA;if (!ffmpeg.current) {&#xA;ffmpeg.current = await createFFmpeg({ log: false });&#xA;}&#xA;&#xA;    const inputName = "input.webm";&#xA;    const outputName = "output.wav";&#xA;    &#xA;    ffmpeg.current.FS("writeFile", inputName, await webmBlob.arrayBuffer());&#xA;    await ffmpeg.current.run("-i", inputName, outputName);&#xA;    &#xA;    const outputData = ffmpeg.current.FS("readFile", outputName);&#xA;    const outputBlob = new Blob([outputData.buffer], { type: "audio/wav" });&#xA;    &#xA;    return outputBlob;&#xA;&#xA;};&#xA;&#xA;const getMicrophonePermission = async () =\> {&#xA;if ("MediaRecorder" in window) {&#xA;try {&#xA;const streamData = await navigator.mediaDevices.getUserMedia({&#xA;audio: true,&#xA;video: false,&#xA;});&#xA;setPermission(true);&#xA;setStream(streamData);&#xA;} catch (err) {&#xA;alert(err.message);&#xA;}&#xA;} else {&#xA;alert("The MediaRecorder API is not supported in your browser.");&#xA;}&#xA;};&#xA;&#xA;const startRecording = async () =\> {&#xA;setRecordingStatus("recording");&#xA;//create new Media recorder instance using the stream&#xA;const media = new MediaRecorder(stream, { type: mimeType });&#xA;//set the MediaRecorder instance to the mediaRecorder ref&#xA;mediaRecorder.current = media;&#xA;//invokes the start method to start the recording process&#xA;mediaRecorder.current.start();&#xA;let localAudioChunks = \[\];&#xA;mediaRecorder.current.ondataavailable = (event) =\> {&#xA;if (typeof event.data === "undefined") return;&#xA;if (event.data.size === 0) return;&#xA;localAudioChunks.push(event.data);&#xA;};&#xA;setAudioChunks(localAudioChunks);&#xA;};&#xA;&#xA;const stopRecording = () =\> {&#xA;setRecordingStatus("inactive");&#xA;//stops the recording instance&#xA;mediaRecorder.current.stop();&#xA;mediaRecorder.current.onstop = async () =\> {&#xA;//creates a blob file from the audiochunks data&#xA;const audioBlob = new Blob(audioChunks, { type: mimeType });&#xA;// creates a playable URL from the blob file.&#xA;const audioUrl = URL.createObjectURL(audioBlob);&#xA;// converts the WebM blob to a WAV blob.&#xA;const newBlob = await convertWebmToWav(audioBlob);&#xA;await onAudioRecorded(newBlob);&#xA;setAudio(audioUrl);&#xA;setAudioChunks(\[\]);&#xA;};&#xA;};&#xA;&#xA;return (&#xA;\&#xA;<h2>Audio Recorder</h2>&#xA;\&#xA;\<div classname="audio-controls">&#xA;{!permission ? (&#xA;\<button type="button">&#xA;Get Microphone&#xA;\&#xA;) : null}&#xA;{permission &amp;&amp; recordingStatus === "inactive" ? (&#xA;\<button type="button">&#xA;Start Recording&#xA;\&#xA;) : null}&#xA;{recordingStatus === "recording" ? (&#xA;\<button type="button">&#xA;Stop Recording&#xA;\&#xA;) : null}&#xA;{audio ? (&#xA;\<div classname="audio-container">&#xA;\<audio src="{audio}">\&#xA;<a>&#xA;Download Recording&#xA;</a>&#xA;\&#xA;) : null}&#xA;\&#xA;\&#xA;\&#xA;);&#xA;};&#xA;export default AudioRecorders;&#xA;&#xA;\`&#xA;&#xA;</audio></div></button></button></button></div>

    &#xA;

    ERROR&#xA;ffmpeg_ffmpeg__WEBPACK_IMPORTED_MODULE_1_ is not a constructor&#xA;TypeError : ffmpeg_ffmpeg__WEBPACK_IMPORTED_MODULE_1_ is not a constructor&#xA;at createFFmpeg (http://localhost:3000/main.48220156e0c620f1acd0.hot-update.js:41:28)&#xA;at convertWebmToWav (http://localhost:3000/main.48220156e0c620f1acd0.hot-update.js:49:30)&#xA;at mediaRecorder.current.onstop (http://localhost:3000/main.48220156e0c620f1acd0.hot-update.js:109:29)`

    &#xA;

    I am trying to record the voice in audio/wav formate but its recording in video/webm formate not because of \<const mimetype="video/webm">. Whatever the mimeType I am giving its showing the file type video/webm on "https://www.checkfiletype.com/". I am recording it for the speech_recognition used in flask backend which is accepting only audio/wav.&#xA;So in frontend I have written a function "convertWebmToWav " which is giving me the error :&#xA;Uncaught runtime errors:&#xA;&#xA;</const>

    &#xA;

  • How to create video from a stream webcam and canvas ?

    1er mai 2024, par Stefdelec

    I am trying to generate a video on browser from different cut :&#xA;Slide : stream from canvas&#xA;Video : stream from webcam

    &#xA;

    I just want to allow user to download the video edit with&#xA;slide1 + video1 + slide2 + video2 + slide3 + video3.

    &#xA;

    Here is my code :

    &#xA;

    const canvas = document.getElementById(&#x27;myCanvas&#x27;);&#xA;const ctx = canvas.getContext(&#x27;2d&#x27;);&#xA;const webcam = document.getElementById(&#x27;webcam&#x27;);&#xA;const videoPlayer = document.createElement(&#x27;video&#x27;);&#xA;videoPlayer.controls = true;&#xA;document.body.appendChild(videoPlayer);&#xA;const videoWidth = 640;&#xA;const videoHeight = 480;&#xA;let keepAnimating = true;&#xA;const frameRate=30;&#xA;// Attempt to get webcam access&#xA;function setupWebcam() {&#xA; const constraints = {&#xA;        video: {&#xA;             frameRate: frameRate,&#xA;            width: videoWidth,  &#xA;            height: videoHeight &#xA;        }&#xA;    };&#xA;  navigator.mediaDevices.getUserMedia(constraints)&#xA;    .then(stream => {&#xA;      webcam.srcObject = stream;&#xA;      webcam.addEventListener(&#x27;loadedmetadata&#x27;, () => {&#xA;        recordSegments();&#xA;        console.log(&#x27;Webcam feed is now displayed&#x27;);&#xA;      });&#xA;    })&#xA;    .catch(err => {&#xA;      console.error("Error accessing webcam:", err);&#xA;      alert(&#x27;Could not access the webcam. Please ensure permissions are granted and try again.&#x27;);&#xA;    });&#xA;}&#xA;&#xA;&#xA;// Function to continuously draw on the canvas&#xA;function animateCanvas(content) {&#xA;  if (!keepAnimating) {&#xA;    console.log("keepAnimating", keepAnimating);&#xA;    return;&#xA;  }; // Stop the animation when keepAnimating is false&#xA;&#xA;  ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear previous drawings&#xA;  ctx.fillStyle = `rgba(${Math.floor(Math.random() * 255)}, ${Math.floor(Math.random() * 255)}, ${Math.floor(Math.random() * 255)}, 0.5)`;&#xA;  ctx.fillRect(0, 0, canvas.width, canvas.height);&#xA;  ctx.fillStyle = &#x27;#000&#x27;;&#xA;  ctx.font = &#x27;48px serif&#x27;;&#xA;  ctx.fillText(content &#x2B; &#x27; &#x27; &#x2B; new Date().toLocaleTimeString(), 50, 100);&#xA;&#xA;  // Request the next frame&#xA;  requestAnimationFrame(() => animateCanvas(content));&#xA;}&#xA;&#xA;&#xA;// Initialize recording segments array&#xA;const recordedSegments = [];&#xA;// Modified startRecording to manage animation&#xA;function startRecording(stream, duration = 5000, content) {&#xA;  const recorder = new MediaRecorder(stream, { mimeType: &#x27;video/webm&#x27; });&#xA;  const data = [];&#xA;&#xA;  recorder.ondataavailable = e => data.push(e.data);&#xA;&#xA;&#xA;  // Start animating the canvas&#xA;  keepAnimating = true;&#xA;  animateCanvas(content);&#xA;  recorder.start();&#xA;  return new Promise((resolve) => {&#xA;    // Automatically stop recording after &#x27;duration&#x27; milliseconds&#xA;    setTimeout(() => {&#xA;      recorder.stop();&#xA;      // Stop the animation when recording stops&#xA;      keepAnimating = false;&#xA;    }, duration);&#xA;&#xA;    recorder.onstop = () => {&#xA;      const blob = new Blob(data, { type: &#x27;video/webm&#x27; });&#xA;      recordedSegments.push(blob);&#xA;       keepAnimating = true;&#xA;      resolve(blob);&#xA;    };&#xA;  });&#xA;}&#xA;&#xA;// Sequence to record segments&#xA;async function recordSegments() {&#xA;  // Record canvas with dynamic content&#xA;  await startRecording(canvas.captureStream(frameRate), 2000, &#x27;Canvas Draw 1&#x27;).then(() => console.log(&#x27;Canvas 1 recorded&#x27;));&#xA;&#xA;      await startRecording(webcam.srcObject,3000).then(() => console.log(&#x27;Webcam 1 recorded&#x27;));&#xA;&#xA;          await startRecording(webcam.srcObject).then(() => console.log(&#x27;Webcam 1 recorded&#x27;));&#xA;  mergeAndDownloadVideo();&#xA;}&#xA;&#xA;function downLoadVideo(blob){&#xA; const url = URL.createObjectURL(blob);&#xA;&#xA;  // Create an anchor element and trigger a download&#xA;  const a = document.createElement(&#x27;a&#x27;);&#xA;  a.style.display = &#x27;none&#x27;;&#xA;  a.href = url;&#xA;  a.download = &#x27;merged-video.webm&#x27;;&#xA;  document.body.appendChild(a);&#xA;  a.click();&#xA;&#xA;  // Clean up by revoking the Blob URL and removing the anchor element after the download&#xA;  setTimeout(() => {&#xA;    document.body.removeChild(a);&#xA;    window.URL.revokeObjectURL(url);&#xA;  }, 100);&#xA;}&#xA;function mergeAndDownloadVideo() {&#xA;  console.log("recordedSegments length", recordedSegments.length);&#xA;  // Create a new Blob from all recorded video segments&#xA;  const superBlob = new Blob(recordedSegments, { type: &#x27;video/webm&#x27; });&#xA;  &#xA;  downLoadVideo(superBlob)&#xA;&#xA;  // Create a URL for the superBlob&#xA; &#xA;}&#xA;&#xA;// Start the process by setting up the webcam first&#xA;setupWebcam();&#xA;

    &#xA;

    You can find it here : https://jsfiddle.net/Sulot/nmqf6wdj/25/

    &#xA;

    I am unable to have one "slide" + webcam video + "slide" + webcam video.

    &#xA;

    It merges only the first 2 segments, but not the other. I tried with ffmpeg browser side.

    &#xA;