Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (50)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (7605)

  • Streaming RTSP (AspNet 5 API, FFMPEG, Angular 10, videoJs)

    27 octobre 2022, par Mephisto

    Description :

    


    I have an API (ASP.Net 5) which connect to an IP Camera through RTSP. The camera send a h264 stream converted with ffmpeg as m3u8 stream which is returned to the angular client as follow :

    


    public async Task<actionresult> GetCameraH264Stream()&#xA;{&#xA;        string deviceIp = "rtsp://[CAMERA_IP]/";&#xA;        string recordingUri = "rtsp://[USER:PASSWORD]@[CAMERA_IP]/axis-media/media.amp";&#xA;        &#xA;        string output = Path.Combine(Path.GetTempPath(), Guid.NewGuid() &#x2B; ".m3u8");&#xA;        var mediaInfo = await FFmpeg.GetMediaInfo(recordingUri);&#xA;&#xA;        var conversionResult = FFmpeg.Conversions.New()&#xA;            .AddStream(mediaInfo.Streams)&#xA;            .SetOutput(output)&#xA;            .Start();&#xA;        &#xA;        // Allow any Cors&#xA;        Response.Headers.Add("Access-Control-Allow-Origin", "*");&#xA;        Response.Headers.Add("Cache-Control", "no-cache");&#xA;        &#xA;        // Open the file, and read the stream to return to the client&#xA;        FileStreamResult result = new FileStreamResult(System.IO.File.Open(output, FileMode.Open, FileAccess.Read, FileShare.Read), "application/octet-stream");&#xA;        result.EnableRangeProcessing = true;&#xA;        return result;&#xA;}&#xA;</actionresult>

    &#xA;

    If I call this methods directly, the browser download a file, which I can read with VLC.

    &#xA;

    In my Angular app, I have this component :

    &#xA;

    app-vjs-player :

    &#xA;

    @Component({&#xA;       selector: &#x27;app-vjs-player&#x27;,&#xA;       template: &#x27;<video class="video-js" controls="controls" muted="muted" playsinline="playsinline" preload="none"> &#xA;                  </video>&#x27;,&#xA;       encapsulation: ViewEncapsulation.None,&#xA;    })&#xA;export class VjsPlayerComponent implements OnInit, OnDestroy {&#xA;  @ViewChild(&#x27;target&#x27;, {static: true}) target: ElementRef;&#xA;  &#xA;  @Input() options: {&#xA;      fluid: boolean,&#xA;      aspectRatio: string,&#xA;      autoplay: boolean,&#xA;      sources: {&#xA;          src: string,&#xA;          type: string,&#xA;      }[],&#xA;      vhs: {&#xA;        overrideNative: true&#xA;      },&#xA;  };&#xA;  player: videojs.Player;&#xA;&#xA;  constructor(&#xA;    private elementRef: ElementRef,&#xA;  ) { }&#xA;&#xA;  ngOnInit() {&#xA;    // instantiate Video.js&#xA;    this.player = videojs(this.target.nativeElement, this.options, function onPlayerReady() {&#xA;      console.log(&#x27;onPlayerReady&#x27;, this);&#xA;    });&#xA;    &#xA;  }&#xA;&#xA;  ngOnDestroy() {&#xA;    // destroy player&#xA;    if (this.player) {&#xA;      this.player.dispose();&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;

    &#xA;

    This component is used like this :

    &#xA;

    TS :

    &#xA;

    playerOptions = {&#xA;    fluid: false,&#xA;    aspectRatio: "16:9",&#xA;      autoplay: false,&#xA;      sources: [{&#xA;          src: &#x27;https://localhost:44311/api/GetCameraH264Stream&#x27;,&#xA;          type: &#x27;application/x-mpegURL&#x27;,&#xA;      }],&#xA;}&#xA;

    &#xA;

    HTML :

    &#xA;

    &#xA;

    &#xA;

    Problem

    &#xA;

    All this seems to work pretty well, until vjs throw this error when the api return the stream :

    &#xA;

    &#xA;

    ERROR : (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported

    &#xA;

    &#xA;

    When I open the network dev tools, the request status is "Canceled", but I don't know if videojs cancel it because the filestreal can't be read, or if it is because of the way the API return the stream.

    &#xA;

    Any idea ?

    &#xA;

    Source

    &#xA;

    Forwarding RTSP stream from IP Camera to Browser in ASP.NET Core

    &#xA;

    VideoJs Angular integration

    &#xA;

    Xabe.FFMPEG

    &#xA;

    EDIT

    &#xA;

      &#xA;
    • I tried to limit the resolution and the bitrate but I can't configure the camera like that, there is other application using it. The camera do not have any streaming url allowing this configuration
    • &#xA;

    • I have been able to get an image from my code after changing the content type of the api response. I changed :
    • &#xA;

    &#xA;

    FileStreamResult result = new FileStreamResult(System.IO.File.Open(output, FileMode.Open, FileAccess.Read, FileShare.Read), "application/octet-stream");&#xA;

    &#xA;

    to

    &#xA;

    FileStreamResult result = new FileStreamResult(System.IO.File.Open(output, FileMode.Open, FileAccess.Read, FileShare.Read), "application/x-mpegURL");&#xA;

    &#xA;

    With this the first packet is displayed, but the next requests are still canceled.

    &#xA;

  • How to use ffmpeg to convert video into the audio format with nodejs and angular in web app

    31 août 2021, par Amir Shahzad

    I want to convert the video into the audio format using ffmpeg in nodejs but I not know how I can implement it in the angular app with nodejs.

    &#xA;

    This is my nodejs code

    &#xA;

      const express = require(&#x27;express&#x27;);&#xA;  const ffmpeg  = require(&#x27;fluent-ffmpeg&#x27;);&#xA;  const fileUpload = require(&#x27;express-fileupload&#x27;);&#xA;  const cors   = require(&#x27;cors&#x27;)&#xA;  const app = express();&#xA;&#xA;  app.use(fileUpload({&#xA;     useTempFiles: true,&#xA;     tempFileDir: &#x27;temp/&#x27;&#xA;  }));&#xA;  app.use(express.json());&#xA;  app.use(express.urlencoded({ extended: true }));&#xA;  app.use(cors({ origin: &#x27;http://localhost:4200&#x27; }));&#xA;&#xA;  ffmpeg.setFfmpegPath(&#x27;/usr/bin/ffmpeg&#x27;);&#xA;&#xA;  // Converting mp4 to audio&#xA;  app.post(&#x27;/mp4tomp3&#x27;, (req, res) => {&#xA;     res.contentType(&#x27;video/avi&#x27;);&#xA;     res.attachment(&#x27;output.mp3&#x27;);&#xA;     req.files.mp4.mv("temp/" &#x2B; req.files.mp4.name , function(err) {&#xA;      if(err){&#xA;        res.sendStatus(500).send(err)&#xA;    }else{&#xA;        console.log("Fiel Uploaded Successfully.!");&#xA;    }&#xA;   });&#xA;     ffmpeg(&#x27;temp/&#x27; &#x2B; req.files.mp4.name)&#xA;       .toFormat(&#x27;mp3&#x27;)&#xA;       .on(&#x27;end&#x27;, function() {&#xA;            console.log(&#x27;Done&#x27;);&#xA;    })&#xA;   .on(&#x27;error&#x27;, function(err){&#xA;         console.log(&#x27;An Error Occured&#x27; &#x2B; err.message)&#xA;    })&#xA;    .pipe(res, {end: true})&#xA;  })&#xA;&#xA;  app.listen(3000, () => {&#xA;    console.log(&#x27;Server Start On Port 3000&#x27;)&#xA;  })&#xA;

    &#xA;

    This code is working good when I use index.html file in the nodejs app but its give an error while I remove index.html file and use angular app for frontend then it give error in nodejs mp4 not defined and name mv is not defined Please tell me how I can implement it using angular framework

    &#xA;

    This is my app.component.html file

    &#xA;

       <div class="container">&#xA;     <h1>Video Proccessing App</h1>&#xA;     <form>&#xA;        <input type="file" formcontrolname="mp4" />&#xA;         <input type="submit" value="Convert" />&#xA;     </form>&#xA;  </div>&#xA;  &#xA;

    &#xA;

    This is my app.component.ts file

    &#xA;

         import { Component, OnInit } from &#x27;@angular/core&#x27;;&#xA;     import { FormBuilder, FormGroup, Validators } from &#x27;@angular/forms&#x27;;&#xA;     import { VideoConversionService } from &#x27;src/services/video-conversion.service&#x27;;&#xA;&#xA;     @Component({&#xA;        selector: &#x27;app-root&#x27;,&#xA;        templateUrl: &#x27;./app.component.html&#x27;,&#xA;        styleUrls: [&#x27;./app.component.css&#x27;]&#xA;     })&#xA;     export class AppComponent implements OnInit {&#xA;&#xA;         submitted =false;&#xA;         form! : FormGroup&#xA;         data:any&#xA;&#xA;&#xA;        constructor(private formBuilder: FormBuilder,&#xA;        private videoService: VideoConversionService){}&#xA;&#xA;&#xA;       creatForm(){&#xA;          this.form = this.formBuilder.group({&#xA;          mp4: [&#x27;&#x27;, Validators.required],&#xA;       });&#xA;      }&#xA;      ngOnInit(): void {&#xA;         this.creatForm();&#xA;&#xA;      }&#xA;&#xA;&#xA;      convertVideo(){&#xA;          this.submitted = true&#xA;          this.videoService.conversion(this.form.value).subscribe(res => {&#xA;          this.data = res;&#xA;         // console.log(this.data)&#xA;         //console.log(this.form.value)&#xA;     })&#xA;     }&#xA;&#xA;     }&#xA;

    &#xA;

    This is my service file for handling the backend api in my angular app

    &#xA;

    import { Injectable } from &#x27;@angular/core&#x27;;&#xA;import { HttpClient  } from &#x27;@angular/common/http&#x27;;&#xA;@Injectable({&#xA;  providedIn: &#x27;root&#x27;&#xA;})&#xA;export class VideoConversionService {&#xA;&#xA;constructor(private httpClient: HttpClient) { }&#xA;&#xA;conversion(data: any){&#xA;   return this.httpClient.post(&#x27;http://localhost:3000/mp4tomp3&#x27;, data)&#xA;}&#xA;}&#xA;

    &#xA;

    This is Screenshot of chrome error

    &#xA;

    while i click on convert button then chrome give that error

    &#xA;

    This is the screenshot of the nodejs app error while I click on the convert button

    &#xA;

    enter image description here

    &#xA;

  • mp4 file upload issue in multer of node.js

    20 mars 2021, par 이훈석

    I'm trying to upload mp4 file by using multer in node.js

    &#xA;

    (View)VideoUploadPage.js

    &#xA;

    import React, { useState } from "react";&#xA;import Axios from "axios";&#xA;&#xA;&#xA;function VideoUploadPage() {&#xA;&#xA;const onDrop = (files) => {&#xA;    let formData = new FormData();&#xA;    const config = {&#xA;      header: { "content-type": "multipart/form-data" },&#xA;    };&#xA;    formData.append("file", files[0]);&#xA;    console.log(files);&#xA;&#xA;    Axios.post("/api/video/uploadfiles", formData, config).then((response) => {&#xA;      if (response.data.success) {&#xA;        console.log(response.data);&#xA;      } else {&#xA;        alert("비디오 업로드를 실패 했습니다.");&#xA;      }&#xA;    });&#xA;  };&#xA;&#xA;}&#xA;

    &#xA;

    (Server)

    &#xA;

    video.js

    &#xA;

    const express = require("express");&#xA;const router = express.Router();&#xA;const multer = require("multer");&#xA;const path = require("path");&#xA;const ffmpeg = require("fluent-ffmpeg");&#xA;&#xA;&#xA;&#xA;let storage = multer.diskStorage({&#xA;  destination: (req, file, cb) => {&#xA;    cb(null, "uploads/");&#xA;  },&#xA;  filename: (req, file, cb) => {&#xA;    cb(null, `${Date.now()}_${file.originalname}`);&#xA;  },&#xA;  fileFilter: (req, file, cb) => {&#xA;    const ext = path.extname(file.originalname);&#xA;    if (ext !== ".mp4") {&#xA;      return cb(res.status(400).end("only mp4 is allowed"), false);&#xA;    }&#xA;    cb(null, true);&#xA;  },&#xA;});&#xA;&#xA;const upload = multer({ storage: storage }).single("file");&#xA;&#xA;router.post("/uploadfiles", (req, res) => {&#xA;  upload(req, res, (err) => {&#xA;    if (err) {&#xA;      return res.json({ success: false, err });&#xA;    }&#xA;    return res.json({&#xA;      success: true,&#xA;      url: res.req.file.path,&#xA;      fileName: res.req.file.filename,&#xA;    });&#xA;  });&#xA;});&#xA;

    &#xA;

    At the video.js destination : (req, file, cb) => &#xA;cb(null, "uploads/")&#xA; <----- I can check which file is going to upload with console.log(response.data), but there is no mp4 file in the "uploads" folder.

    &#xA;

    When I changed "uploads/" to my local directory path, mp4 file is on the uploads folder ....

    &#xA;

    ex : "C :// /uploads"

    &#xA;

    Any idea ?

    &#xA;