Recherche avancée

Médias (91)

Autres articles (83)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (7753)

  • NodeJS : Fail to write byte array input from webcam to ffmpeg spawn process

    23 mai 2024, par Thanesh Prabaghan

    I'm using NodeJS server to display an HTML page which has webcam option. Once user visited to my NodeJS server, it will serve html page. User can allow webcam option and see webcam view on the page.

    


    In the backend, I send webcam stream (byte array) using socket.io. I receive byte array successfully in backend with the help of socket.io. BUT MY PROBLEM IS, I can't pipe this byte array to the ffmpeg spawn process. I don't know how to properly pipe this data to the ffmpeg. Once it done, all my problem will be solved.

    


    On the other side, I have node-media-server as RTMP server to publish this stream to VLC player and other devices. Kindly help me to complete this task. I will attach all my code to this question. Kindly run this in your environment and answer the question.

    


    MY HTML PAGE

    


    &#xA;&#xA;  &#xA;    &#xA;      &#xA;&#xA;      &#xA;&#xA;      <code class="echappe-js">&lt;script src=&quot;https://cdn.socket.io/4.7.5/socket.io.min.js&quot; &amp;#xA;        integrity=&quot;integrity_code&quot; &amp;#xA;        crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;&#xA;    &#xA;    &#xA;      
    &#xA; &#xA;&#xA; &lt;script&gt;&amp;#xA;          const socket = io(&amp;#x27;http://localhost:8080/&amp;#x27;);&amp;#xA;          var video = document.getElementById(&quot;video&quot;);&amp;#xA;&amp;#xA;          if (navigator.mediaDevices.getUserMedia) {&amp;#xA;            navigator.mediaDevices.getUserMedia({ video: true, audio:true })&amp;#xA;            .then(function (stream) {&amp;#xA;              const recorder = new MediaRecorder(stream);&amp;#xA;&amp;#xA;              recorder.ondataavailable = event =&gt; {&amp;#xA;                socket.emit(&amp;#x27;VideoStream&amp;#x27;, event.data);&amp;#xA;              };&amp;#xA;              recorder.start(1000);      &amp;#xA;              video.srcObject = stream;&amp;#xA;            }).catch(function (error) {&amp;#xA;              console.log(&quot;Something went wrong!&quot;);&amp;#xA;            });&amp;#xA;         }  &amp;#xA;       &lt;/script&gt;&#xA; &#xA;&#xA;&#xA;

    &#xA;

    FFMPEG IMPLEMENTATION

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const app = express();&#xA;const http = require(&#x27;http&#x27;);&#xA;const server = http.createServer(app);&#xA;const { Server } = require("socket.io");&#xA;const io = new Server(server);&#xA;const path = require(&#x27;node:path&#x27;); &#xA;const { spawn } = require(&#x27;node:child_process&#x27;);&#xA;&#xA;let cmd = spawn(&#x27;ffmpeg.exe&#x27;, [&#xA;    &#x27;-c:v&#x27;, &#x27;copy&#x27;, &#x27;-preset&#x27;, &#x27;ultrafast&#x27;, &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,&#xA;    &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-strict&#x27;, &#x27;-2&#x27;, &#x27;-ar&#x27;, &#x27;44100&#x27;, &#x27;-b:a&#x27;, &#x27;64k&#x27;,&#xA;    &#x27;-y&#x27;,&#xA;    &#x27;-use_wallclock_as_timestamps&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-async&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-flush_packets&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-rtbufsize&#x27;, &#x27;1000&#x27;,&#xA;    &#x27;-bufsize&#x27;, &#x27;1000&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;     &#x27;-i&#x27;,&#x27;-&#x27;,&#xA;    &#x27;rtmp://localhost:1935&#x27;,&#xA;  ]);&#xA;&#xA;app.use(express.static(path.join(__dirname, &#x27;public&#x27;)));&#xA;&#xA;app.get(&#x27;/&#x27;, (req, res) => {&#xA;  res.sendFile(path.join(__dirname &#x2B; &#x27;index.html&#x27;));&#xA;});&#xA;&#xA;io.on(&#x27;connection&#x27;, (socket) => {&#xA;  socket.on("VideoStream", (data) => {&#xA;    cmd.stdin.write(data);&#xA;  });&#xA;});&#xA;&#xA;server.listen(8080, () => {&#xA;  console.log(&#x27;listening on *:8080&#x27;);&#xA;});&#xA;&#xA;```&#xA;**NODE MEDIA SERVER IMPLEMENTATION**&#xA;&#xA;```&#xA;const NodeMediaServer = require(&#x27;node-media-server&#x27;);&#xA;&#xA;const config = {&#xA;  rtmp: {&#xA;    port: 1935,&#xA;    chunk_size: 60000,&#xA;    gop_cache: true,&#xA;    ping: 30,&#xA;    ping_timeout: 60&#xA;  },&#xA;  http: {&#xA;    port: 8000,&#xA;    allow_origin: &#x27;*&#x27;&#xA;  }&#xA;};&#xA;&#xA;var nms = new NodeMediaServer(config)&#xA;nms.run();&#xA;```&#xA;&#xA;&#xA;

    &#xA;

  • How to sync network audio with a different network video and play it with chewie

    26 mars 2023, par Rudra Sharma

    I am trying to stream a reddit videos on my app. For that reason I am using Reddit API but it is only giving the video url like 'redd.it/mpym0z9q8opa1/DASH_1080.mp4 ?source=fallback' with no audio but after some research I found out that we can get audio url by editing video url 'redd.it/mpym0z9q8opa1/DASH_audio.mp4 ?source=fallback'.

    &#xA;

    Now I have both audio and video url with me how can I sync them on network and stream them on my app using chewie package (video player).

    &#xA;

    This my code so far

    &#xA;

    import &#x27;dart:async&#x27;;&#xA;import &#x27;dart:convert&#x27;;&#xA;import &#x27;package:http/http.dart&#x27; as http;&#xA;import &#x27;package:flutter/material.dart&#x27;;&#xA;import &#x27;package:video_player/video_player.dart&#x27;;&#xA;import &#x27;package:chewie/chewie.dart&#x27;;&#xA;&#xA;void main() => runApp(MyApp());&#xA;&#xA;class MyApp extends StatelessWidget {&#xA;  @override&#xA;  Widget build(BuildContext context) {&#xA;    return MaterialApp(&#xA;      title: &#x27;Reddit Videos&#x27;,&#xA;      theme: ThemeData(&#xA;        primarySwatch: Colors.blue,&#xA;        visualDensity: VisualDensity.adaptivePlatformDensity,&#xA;      ),&#xA;      home: VideoPlayerScreen(),&#xA;    );&#xA;  }&#xA;}&#xA;&#xA;class VideoPlayerScreen extends StatefulWidget {&#xA;  @override&#xA;  _VideoPlayerScreenState createState() => _VideoPlayerScreenState();&#xA;}&#xA;&#xA;class _VideoPlayerScreenState extends State<videoplayerscreen> {&#xA;  final List<string> _videoUrls = [];&#xA;&#xA;  @override&#xA;  void initState() {&#xA;    super.initState();&#xA;    _loadVideos();&#xA;  }&#xA;&#xA;  Future<void> _loadVideos() async {&#xA;    try {&#xA;      final videoUrls =&#xA;          await RedditApi.getVideoUrlsFromSubreddit(&#x27;aww&#x27;);&#xA;&#xA;      setState(() {&#xA;        _videoUrls.addAll(videoUrls);&#xA;      });&#xA;    } catch (e) {&#xA;      print(e);&#xA;    }&#xA;  }&#xA;&#xA;  @override&#xA;  Widget build(BuildContext context) {&#xA;    return Scaffold(&#xA;      appBar: AppBar(&#xA;        title: Text(&#x27;Reddit Videos&#x27;),&#xA;      ),&#xA;      body: SafeArea(&#xA;        child: _videoUrls.isNotEmpty&#xA;            ? _buildVideosList()&#xA;            : Center(child: CircularProgressIndicator()),&#xA;      ),&#xA;    );&#xA;  }&#xA;&#xA;  Widget _buildVideosList() {&#xA;    return ListView.builder(&#xA;      itemCount: _videoUrls.length,&#xA;      itemBuilder: (context, index) {&#xA;        return Padding(&#xA;          padding: const EdgeInsets.all(8.0),&#xA;          child: Chewie(&#xA;            controller: ChewieController(&#xA;              videoPlayerController: VideoPlayerController.network(&#xA;                _videoUrls[index],&#xA;              ),&#xA;              aspectRatio: 9 / 16,&#xA;              autoPlay: true,&#xA;              looping: true,&#xA;              autoInitialize: true,&#xA;            ),&#xA;          ),&#xA;        );&#xA;      },&#xA;    );&#xA;  }&#xA;}&#xA;&#xA;class RedditApi {&#xA;  static const String BASE_URL = &#x27;https://www.reddit.com&#x27;;&#xA;  static const String CLIENT_ID = &#x27;id&#x27;;&#xA;  static const String CLIENT_SECRET = &#x27;secret&#x27;;&#xA;&#xA;  static Future> getVideoUrlsFromSubreddit(&#xA;      String subredditName) async {&#xA;    final response = await http.get(&#xA;        Uri.parse(&#x27;$BASE_URL/r/$subredditName/top.json?limit=10&#x27;),&#xA;        headers: {&#x27;Authorization&#x27;: &#x27;Client-ID $CLIENT_ID&#x27;});&#xA;&#xA;    if (response.statusCode == 200) {&#xA;      final jsonData = jsonDecode(response.body);&#xA;      final postsData = jsonData[&#x27;data&#x27;][&#x27;children&#x27;];&#xA;&#xA;      final videoUrls = <string>[];&#xA;&#xA;      for (var postData in postsData) {&#xA;        if (postData[&#x27;data&#x27;][&#x27;is_video&#x27;]) {&#xA;          videoUrls.add(postData[&#x27;data&#x27;][&#x27;media&#x27;][&#x27;reddit_video&#x27;]&#xA;              [&#x27;fallback_url&#x27;]);&#xA;        }&#xA;      }&#xA;&#xA;      return videoUrls;&#xA;    } else {&#xA;      throw Exception("Failed to load videos from subreddit");&#xA;    }&#xA;  }&#xA;}&#xA;</string></void></string></videoplayerscreen>

    &#xA;

    I think the code is self explainatory about what I am trying to achieve (Trying to make a client for reddit).

    &#xA;

  • How to stream and play video automatically using PHP FFmpeg Video Streaming libray

    21 août 2020, par kikabi francis

    Am currently new to ffmpeg video streaming and working on a project to stream mp4 videos using ffmpeg libray https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming and Video player https://videojs.com/ using DASH.&#xA;Am currently starting the streaming to mpd using commandline, with streaming.php.&#xA;I want to start streaming automatically when dash.html with video playing.&#xA;and i want to switch between different video qualities on the player, currently it play the same quality set in streaming.php&#xA;Here is my code

    &#xA;

         &#xA;    &#xA;    &#xA;    &#xA;    &#xA;    &#xA;    &#xA;    &#xA;    &#xA;    <video height="480" data-setup="&#x27;{&quot;liveui&quot;:" class="video-js vjs-default-skin" controls="controls"></video>&#xA;        <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/app/js/plugins/node/video.js/dist/video.js'&gt;&lt;/script&gt;&#xA;        &lt;script src='http://stackoverflow.com/feeds/tag/app/js/plugins/switcher/videojs-resolution-switcher.js'&gt;&lt;/script&gt;&#xA;        &#xA;        &lt;script src='http://stackoverflow.com/feeds/tag/app/js/plugins/node/dashjs/dist/dash.all.min.js'&gt;&lt;/script&gt;&#xA;        &#xA;        &#xA;        &lt;script src='http://stackoverflow.com/feeds/tag/app/js/plugins/node/videojs-contrib-dash/dist /videojs-dash.js'&gt;&lt;/script&gt;&#xA;         &#xA;        &lt;script&gt;&amp;#xA;&amp;#xA;        var player = videojs(&amp;#x27;example-video&amp;#x27;);&amp;#xA;&amp;#xA;        player.ready(function() {&amp;#xA;            player.updateSrc([&amp;#xA;            {&amp;#xA;              src: &amp;#x27;http://localhost/MovieWeb/media/stream/dash-stream.mpd&amp;#x27;,&amp;#xA;              type: &amp;#x27;application/dash&amp;#x2B;xml&amp;#x27;,&amp;#xA;              label: &amp;#x27;144p&amp;#x27;,&amp;#xA;              res: 144&amp;#xA;            },&amp;#xA;            {&amp;#xA;              src: &amp;#x27;http://localhost/MovieWeb/media/stream/dash-stream.mpd&amp;#x27;,&amp;#xA;              type: &amp;#x27;application/dash&amp;#x2B;xml&amp;#x27;,&amp;#xA;              label: &amp;#x27;240p&amp;#x27;,&amp;#xA;              res: 240&amp;#xA;            },&amp;#xA;            {&amp;#xA;              src: &amp;#x27;http://localhost/MovieWeb/media/stream/dash-stream.mpd&amp;#x27;,&amp;#xA;              type: &amp;#x27;application/dash&amp;#x2B;xml&amp;#x27;,&amp;#xA;              label: &amp;#x27;360p&amp;#x27;,&amp;#xA;              res: 360&amp;#xA;            },&amp;#xA;            {&amp;#xA;              src: &amp;#x27;http://localhost/MovieWeb/media/stream/dash-stream.mpd&amp;#x27;,&amp;#xA;              type: &amp;#x27;application/dash&amp;#x2B;xml&amp;#x27;,&amp;#xA;              label: &amp;#x27;480p&amp;#x27;,&amp;#xA;              res: 480&amp;#xA;            },&amp;#xA;            {&amp;#xA;              src: &amp;#x27;http://localhost/MovieWeb/media/stream/dash-stream.mpd&amp;#x27;,&amp;#xA;              type: &amp;#x27;application/dash&amp;#x2B;xml&amp;#x27;,&amp;#xA;              label: &amp;#x27;720p&amp;#x27;,&amp;#xA;              res: 720&amp;#xA;            },&amp;#xA;            {&amp;#xA;              src: &amp;#x27;http://localhost/MovieWeb/media/stream/dash-stream.mpd&amp;#x27;,&amp;#xA;              type: &amp;#x27;application/dash&amp;#x2B;xml&amp;#x27;,&amp;#xA;              label: &amp;#x27;1080p&amp;#x27;,&amp;#xA;              res: 1080&amp;#xA;            }&amp;#xA;          ])&amp;#xA;         &amp;#xA;          player.play();&amp;#xA;        });&amp;#xA;        player.videoJsResolutionSwitcher();&amp;#xA;        &lt;/script&gt; &#xA;    &#xA;    &#xA;&#xA;&#xA;//video.php&#xA;< ?php&#xA;require ('api/libs/ffmpeg_video_stream/vendor/autoload.php') ;&#xA;use Streaming\Representation ;&#xA;$r_144p  = (new Representation)->setKiloBitrate(95)->setResize(256, 144) ;&#xA;$r_240p  = (new Representation)->setKiloBitrate(150)->setResize(426, 240) ;&#xA;$r_360p  = (new Representation)->setKiloBitrate(276)->setResize(640, 360) ;&#xA;$r_480p  = (new Representation)->setKiloBitrate(750)->setResize(854, 480) ;&#xA;$r_720p  = (new Representation)->setKiloBitrate(2048)->setResize(1280, 720) ;&#xA;$r_1080p = (new Representation)->setKiloBitrate(4096)->setResize(1920, 1080) ;&#xA;$config = [&#xA;      'ffmpeg.binaries'  => 'C :/ffmpeg/bin/ffmpeg.exe',&#xA;      'ffprobe.binaries' => 'C :/ffmpeg/bin/ffprobe.exe',&#xA;      'timeout'          => 3600, // The timeout for the underlying process&#xA;      'ffmpeg.threads'   => 12,   // The number of threads that FFmpeg should use&#xA;  ] ;&#xA;$ffmpeg = Streaming\FFMpeg::create($config) ;&#xA;$video = $ffmpeg->open('media/videos/dir686840/1080p_video.mp4') ;&#xA;$video->dash()&#xA;      ->setAdaption('id=0,streams=v id=1,streams=a')&#xA;      ->x264()&#xA;      ->addRepresentations([$r_360p])&#xA;      ->save('media/stream/dash-stream.mpd') ;&#xA; ?>&#xA;

    &#xA;

    Thank you very much !!

    &#xA;