Recherche avancée

Médias (91)

Autres articles (111)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (10460)

  • Solution for VB6 to broadcast Webcam

    14 septembre 2018, par vantrung -cuncon

    Sorry, I know VB6 is decades ago, but I’m in a situation that I have to use VB6 to deliver live webcam stream beetween 2 PC in Server - Client Model program. Vb6-code holds the connection then I have no choice but to transfer all data via that connection.

    I’ve tried weeks for this, uncountable approaches but went to nowhere.
    My efforts focused on 3 major approaches :

    1/ Use ffmpeg to record live webcam as ".avi" file on hard disk, transfer parts of file to other end & play it. But I’ve stucked with a media-player that can play a "being written" avi file.

    Windows Media Player control told me "file already in use..." & VLC Plugin can’t even be added to VB6 (axvlc.dll).

    2/ Use ffmpeg to save live webcam as avi file, transfer each bit of that file to the other end, then in other end, extract 24 images / second from the avi to display continously in a picture box.
    This approach is ok except that my hard disk get fulled of images in a time of wink and my program get very slow before hanging.

    3/ Use ffmpeg to stream the live webcam to a rtp-port like this :

    ffmpeg -f dshow -i video="Lenovo EasyCamera" -vcodec mpeg2video -pix_fmt yuv422p -f rtp -an rtp://224.1.2.3:8191

    I’ve successfully watch the stream in VLC, but VLC(axvlc.dll) refused to be integrated into ancient VB6. And more important, I don’t know how to redirect/reroute the rtp stream to other PC with VB6.

    Any one please light me up ? (Any 3rd party component is welcomed)

  • Capturing audio data (using javascript) and uploading on a server as MP3

    4 septembre 2018, par Michel

    Following a number of resources on the internet, I am trying to build a simple web page, where I can go to record something (my voice), then make a mp3 file out of the recording and finally upload that file to a server.

    At this point I can do the recording and also play back, but I haven’t gone as far as uploading, it seems like I cannot even make an mp3 file locally.
    Can someone tell me what I am doing wrong, or in the wrong order ?

    Below is all the code I have at this point.

       
       
       
       


    <div>
       <h2>Audio record and playback</h2>
       <p>
           <button></button></p><h3>Start</h3>
           <button disabled="disabled"><h3>Stop</h3></button>
           <audio controls="controls"></audio>
           <a></a>
       
    </div>

    <code class="echappe-js">&lt;script&gt;<br />
     var player = document.getElementById('player');<br />
    <br />
     var handleSuccess = function(stream) {<br />
       rec = new MediaRecorder(stream);<br />
    <br />
       rec.ondataavailable = e =&gt; {<br />
           audioChunks.push(e.data);<br />
           if (rec.state == &quot;inactive&quot;) {<br />
               let blob = new Blob(audioChunks,{type:'audio/x-mpeg-3'});<br />
               player.src = URL.createObjectURL(blob);<br />
               player.controls=true;<br />
               player.autoplay=true;<br />
               // audioDownload.href = player.src;<br />
               // audioDownload.download = 'sound.data';<br />
               // audioDownload.innerHTML = 'Download';<br />
               mp3Build();<br />
           }<br />
       }<br />
    <br />
       player.src = stream;<br />
     };<br />
    <br />
     navigator.mediaDevices.getUserMedia({audio:true/*, video: false */})<br />
         .then(handleSuccess);<br />
    <br />
    startRecord.onclick = e =&gt; {<br />
     startRecord.disabled = true;<br />
     stopRecord.disabled=false;<br />
     audioChunks = [];<br />
     rec.start();<br />
    }<br />
    <br />
    stopRecord.onclick = e =&gt; {<br />
     startRecord.disabled = false;<br />
     stopRecord.disabled=true;<br />
     rec.stop();<br />
    }<br />
    <br />
    <br />
    var ffmpeg = require('ffmpeg');<br />
    <br />
    function mp3Build() {<br />
    try {<br />
       var process = new ffmpeg('sound.data');<br />
       process.then(function (audio) {<br />
           // Callback mode.<br />
           audio.fnExtractSoundToMP3('sound.mp3', function (error, file) {<br />
               if (!error) {<br />
                   console.log('Audio file: ' + file);<br />
           audioDownload.href = player.src;<br />
           audioDownload.download = 'sound.mp3';<br />
           audioDownload.innerHTML = 'Download';<br />
         } else {<br />
           console.log('Error-fnExtractSoundToMP3: ' + error);<br />
         }<br />
           });<br />
       }, function (err) {<br />
           console.log('Error: ' + err);<br />
       });<br />
    } catch (e) {<br />
       console.log(e.code);<br />
       console.log(e.msg);<br />
    }<br />
    }<br />
    <br />
    &lt;/script&gt;

    When I try to investigate and see what is happening using the Debugger inside the Web Console ; on the line :

    var process = new ffmpeg('sound.data');

    I get this message :

    Paused on exception
    TypeError ffmpeg is not a contructor.

    And on the line :

    var ffmpeg = require('ffmpeg');

    I get this message :

    Paused on exception
    ReferenceError require is not defined.

    Beside when I watch the expression ffmpeg, I can see :

    ffmpeg: undefined

    After some further investigations, and using browserify I use the following code :

       
       
       
       


    <div>
       <h2>Audio record and playback</h2>
       <p>
           <button></button></p><h3>Start</h3>
           <button disabled="disabled"><h3>Stop</h3></button>
           <audio controls="controls"></audio>
           <a></a>
       
    </div>

    <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/bundle.js'&gt;&lt;/script&gt;
    &lt;script&gt;<br />
     var player = document.getElementById('player');<br />
    <br />
     var handleSuccess = function(stream) {<br />
       rec = new MediaRecorder(stream);<br />
    <br />
       rec.ondataavailable = e =&gt; {<br />
           if (rec.state == &quot;inactive&quot;) {<br />
               let blob = new Blob(audioChunks,{type:'audio/x-mpeg-3'});<br />
               //player.src = URL.createObjectURL(blob);<br />
               //player.srcObject = URL.createObjectURL(blob);<br />
               //player.srcObject = blob;<br />
               player.srcObject = stream;<br />
               player.controls=true;<br />
               player.autoplay=true;<br />
               // audioDownload.href = player.src;<br />
               // audioDownload.download = 'sound.data';<br />
               // audioDownload.innerHTML = 'Download';<br />
               mp3Build();<br />
           }<br />
       }<br />
    <br />
       //player.src = stream;<br />
       player.srcObject = stream;<br />
     };<br />
    <br />
     navigator.mediaDevices.getUserMedia({audio:true/*, video: false */})<br />
         .then(handleSuccess);<br />
    <br />
    startRecord.onclick = e =&gt; {<br />
     startRecord.disabled = true;<br />
     stopRecord.disabled=false;<br />
     audioChunks = [];<br />
     rec.start();<br />
    }<br />
    <br />
    stopRecord.onclick = e =&gt; {<br />
     startRecord.disabled = false;<br />
     stopRecord.disabled=true;<br />
     rec.stop();<br />
    }<br />
    <br />
    <br />
    var ffmpeg = require('ffmpeg');<br />
    <br />
    function mp3Build() {<br />
    try {<br />
       var process = new ffmpeg('sound.data');<br />
       process.then(function (audio) {<br />
           // Callback mode.<br />
           audio.fnExtractSoundToMP3('sound.mp3', function (error, file) {<br />
               if (!error) {<br />
                   console.log('Audio file: ' + file);<br />
           //audioDownload.href = player.src;<br />
           audioDownload.href = player.srcObject;<br />
           audioDownload.download = 'sound.mp3';<br />
           audioDownload.innerHTML = 'Download';<br />
         } else {<br />
           console.log('Error-fnExtractSoundToMP3: ' + error);<br />
         }<br />
           });<br />
       }, function (err) {<br />
           console.log('Error: ' + err);<br />
       });<br />
    } catch (e) {<br />
       console.log(e.code);<br />
       console.log(e.msg);<br />
    }<br />
    }<br />
    <br />
    &lt;/script&gt;

    That solved the problem of :

    the expression ffmpeg being: undefined

    But the play back is no longer working. I may not be doing the right thing with player.srcObject and maybe some other things too.

    When I use this line :

    player.srcObject = URL.createObjectURL(blob);

    I get this message :

    Paused on exception
    TypeError: Value being assigned to HTMLMediaElement.srcObject is not an object.

    And when I use this line :

    player.srcObject = blob;

    I get this message :

    Paused on exception
    TypeError: Value being assigned to HTMLMediaElement.srcObject does not implement interface MediaStream.

    Finally, if I use this :

    player.srcObject = stream;

    I do not get any error message but the voice recording still does not work.

  • How to convert a video and audio file to be smoothly played via Media Source Extension API ?

    4 octobre 2018, par Aman

    I have built a web video player using the Media Source Extension API. I have been testing my video player using local video and audio files on my PC. Everything works perfectly expect the video keeps buffering. I’m playing a 4k 60fps video, which I downloaded from YouTube. My PC is not 4k resolution, but the video smoothly plays through YouTube and VLC Media Player. I’m just surprised to why my Media Source Extension Video Player buffers even through the video and audio file are not being retrieved via network. I’m assuming that the video and audio files I’m using are causing this problem. So I will explain how I created my video and audio files first :

    1. I downloaded the video from https://www.youtube.com/watch?v=KaCQ8SQ6ZHQ&t=3s using the 4K Video Downloader https://www.4kdownload.com/products/product-videodownloader.

    2. Convert the mkv (the 4K Video Downloader only allows the 4k 60fps video to be downloaded in mkv format, for me) file to mp4 using ffmpeg in CMD : ffmpeg -i test.mkv -codec copy test.mp4.

    3. Converting the test.mp4 file to my preferred 4K resolution 3840x2160 from 3840x1632 using ffmpeg in CMD : ffmpeg -i test.mp4 -s 3840x2160 -c:a copy test_changed.mp4. (NOT SO IMPORTANT)

    4. Separating the video and audio of test_changed.mp4 to video.mp4 for video and audio.mp4 for audio using MP4Box in CMD : Video - MP4Box -single 1 test_changed.mp4 -out video.mp4 and Audio - MP4Box -single 2 test_changed.mp4 -out audio.mp4.

    5. Splitting both video.mp4 and audio.mp4 into 30 split parts each containing 5 seconds of the video and audio file. So I end up having (video_1.mp4,audio_1.mp4), (video_2.mp4,audio_2.mp4), (video_3.mp4,audio_3.mp4), ..... (video_29.mp4,audio_29.mp4), (video_30.mp4,audio_30.mp4). Using ffmpeg and one by one specifying the time range for each part in CMD :

      [For Part 1 : ffmpeg -ss 00:00:00 -to 00:00:05 -i video.mp4 video_1.mp4, ffmpeg -ss 00:00:00 -to 00:00:05 -i audio.mp4 audio_1.mp4],

      [For Part 2 : ffmpeg -ss 00:00:05 -to 00:00:10 -i video.mp4 video_2.mp4, ffmpeg -ss 00:00:05 -to 00:00:10 -i audio.mp4 audio_2.mp4],

      [For Part 3 : ffmpeg -ss 00:00:10 -to 00:00:15 -i video.mp4 video_3.mp4, ffmpeg -ss 00:00:10 -to 00:00:15 -i audio.mp4 audio_3.mp4],

      .....

      [For Part 29 : ffmpeg -ss 00:02:20 -to 00:02:25 -i video.mp4 video_29.mp4, ffmpeg -ss 00:02:20 -to 00:02:25 -i audio.mp4 audio_29.mp4],

      [For Part 30 : ffmpeg -ss 00:02:25 -to 00:02:30 -i video.mp4 video_30.mp4, ffmpeg -ss 00:02:25 -to 00:02:30 -i audio.mp4 audio_30.mp4].

    6. Fragmenting each of the video and audio parts using MP4Box in CMD(As far as I know, fragmented mp4 files are only files played via Media Source Extension API) :

      [For Part 1 : MP4Box -dash 1000 -rap -frag-rap video_1.mp4, MP4Box -dash 1000 -rap -frag-rap audio_1.mp4],

      [For Part 2 : MP4Box -dash 1000 -rap -frag-rap video_2.mp4, MP4Box -dash 1000 -rap -frag-rap audio_2.mp4],

      [For Part 3 : MP4Box -dash 1000 -rap -frag-rap video_3.mp4, MP4Box -dash 1000 -rap -frag-rap audio_3.mp4],

      .....

      [For Part 29 : MP4Box -dash 1000 -rap -frag-rap video_29.mp4, MP4Box -dash 1000 -rap -frag-rap audio_29.mp4],

      [For Part 30 : MP4Box -dash 1000 -rap -frag-rap video_30.mp4, MP4Box -dash 1000 -rap -frag-rap audio_30.mp4].

    7. I receive a fragmented file for each file with "_dashinit" being in it e.g. For Part 1 : video_1_dashinit.mp4 and audio_1_dashinit.mp4. These are the files I’m playing through Media Source Extension API.

    So I’m appending these files into my sourceBuffers and playing it with the video. I have given the test.zip file here (https://drive.google.com/file/d/1tyPBTxgpS601Xs5VEWznYhWw9PwhMHsB/view?usp=sharing) containing the test sample.

    I’m using this command in CMD to run Chrome and test my file : chrome.exe --allow-file-access-from-files

    Anyone can use this test sample and see if the video is buffering for them too. Please comment about anything I’m doing wrong, or help me construct a better 5 seconds video and audio files for MSE playable. Thanks