Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (100)

  • 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 (7580)

  • Recording audio with MediaRecorder on iPhone with Safari and Chrome only 1 second long ? Mimetype and FFMPEG problem ?

    9 mai 2023, par Avatar

    I am using MediaRecorder to record the Microphone audio on a website.

    


    Javascript :

    


    var blob;
var blob_url;
var stream;
var recorder;
var chunks;

var media = {
    tag: 'audio',
    type: 'audio/ogg',
    ext: '.ogg',
    gUM: {audio: true}
};

navigator.mediaDevices.getUserMedia(media.gUM).then(_stream => 
{
    stream = _stream;

    recorder = new MediaRecorder(stream);

    recorder.ondataavailable = e => 
    {
        // push data to chunks
        chunks.push(e.data);

        // recording has been stopped
        if(recorder.state == 'inactive') 
        {
            // audio data available
            blob = new Blob(chunks, {type: media.type });
            blob_url = URL.createObjectURL(blob);
            
            // send data to server
            uploadfile_audio();
        }
    };

    if(typeof(recorder)=='undefined')
    {
        alert('No microphone access');
        return;
    }

    chunks = [];
    recorder.start();
}


// when stop button is clicked
recorder.stop();
stream.getTracks().forEach( track => track.stop() );


    


    The audio stream (ogg format) is sent to the server.

    


    Since iPad/iPhone do not play ogg files, the recording file is converted to "mp3" using FFMPEG.

    


    This file is stored on the server.

    

    


    This works on Windows and MAC (Chrome and Safari), also on iPad (Safari) but not properly on iPhone (Chrome/Safari). Version : iPhone iOS 15.1.

    


    On iPhone the recording file is only 0:01 min in length. Size is always 17277 Bytes.

    


    What could be the issue ? (I cannot debug because I don't have a Mac.)

    


    Does the stream get interrupted ? Is the recording stopped after 1 second ?

    


    Update 1 :

    


    I have checked the incoming filesize of the browser-recorded file serverside. It seems to be coming in properly, because there are different sizes such as 184 kB.

    


    My guess is now that FFMPEG cannot handle the incoming file correctly. Which might have the wrong mimetype set in Javascript with type: 'audio/ogg',. Is another format needed ?

    


    The conversion code serverside :

    


    PHP

    


    $mp3file = shell_exec("ffmpeg -i ".$file_locationtmp." -vn -ar 44100 -ac 2 -b:a 128k ".$file_locationtmp.".mp3");


    


    I would need to find out the audio recording format used by iPhone but I couldn't.

    


    I tried to find the supporting mimetypes using https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported - however, it shows that NO mimetypes are supported on iPhone (neither in Chrome nor Safari).

    


    Update 2 :

    


    I used ffprobe to get the recording file information. It says Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 2234 kb/s (default)

    


    Update 3 :

    


    It seems to be a problem with FFMPEG. See my new question How to convert AAC/MP4A to MP3 using FFMPEG in full length ? Audio file gets cut off after 1 second

    


  • Subprocess doesn't return expected result

    8 avril 2023, par Gren Man

    Subprocess doesn't return expected result

    


    I have been trying getting info from video files using ffprobe

    


    But I stumbled upon unexpected results, here are some test I've done

    


    First test

    


    # ffprobe -v error -select_streams v:0 -show_entries stream=height,width -of csv=s=x:p=0 
proc = subprocess.Popen(['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 
       'stream=height,width', '-of', 'csv=s=x:p=0 ', video_path],
       stdout=subprocess.PIPE, stdin=subprocess.PIPE)

# proc.stdout.read() Returns  b'widthXheightt\r\n'
v_resolution = proc.stdout.read().decode('utf-8').replace('\r', '').replace('\n', '')
# Result 'widthXheight'


    


    First test was successful.

    


    Second test

    


    # ffprobe -v error -select_streams v:0 -show_entries stream=display_aspect_ratio -of default=noprint_wrappers=1:nokey=1
proc = subprocess.Popen(['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries',
       'stream=display_aspect_ratio','-of default=noprint_wrappers=1:nokey=1', video_path],
       stdout=subprocess.PIPE, stdin=subprocess.PIPE)

# proc.stdout.read() Returns b''
a_r = proc.stdout.read().decode('utf-8').replace('\r', '').replace('\n', '')
# Result ''


    


    Hmm, this doesn't sounds right I thought result should be e.g. 16:9

    


    I tried putting code to CMD which returned aforementioned result

    


    Third test

    


    # ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate
proc = subprocess.Popen(['ffprobe', '-v', 'error', '-select_streams', 'v', '-of',
       'default=noprint_wrappers=1:nokey=1','-show_entries', 'stream=r_frame_rate',
       video_path], stdout=subprocess.PIPE, stdin=subprocess.PIPE)

# proc.stdout.read() Returns b'30/1'
fps = proc.stdout.read().decode('utf-8').replace('\r', '').replace('\n', '') + ' fps'
# Result 30/1 fps


    


    Just as expected this returned subarashi result

    


    But what happened in a second test ? Can somebody explain it to me ? I used stderr which returned :

    


    Failed to set value 'foo.mp4' for option 'of default=noprint_wrappers=1:nokey=1': Option not found


    


    Result of python code

    


    Result

    


  • ffmpeg : packet size 2073600 expected frame_size 4147200

    18 avril 2020, par mrana

    I have total 96 videos. I have converted most of videos using ffmpeg, 
but for some videos its giving me some error. 
As a first step I deinterlaced the video using the following command :

    



    ffmpeg -video_size 1920x1080 -r 25 -pixel_format yuv422p -i stockholm.yuv -vf yadif  stockholm_deInt.yuv


    



    And I am getting the following error :

    



    


    [rawvideo @ 0x7fa144008c00] Invalid buffer size, packet size 2073600 < expected frame_size 4147200
    &#xA; Error while decoding stream #0:0 : Invalid argument&#xA; frame= 187 fps=3.7 q=-0.0 Lsize= 757350kB time=00:00:07.48 bitrate=829440.0kbits/s
    &#xA; video:757350kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead : 0.000000%

    &#xA;

    &#xA;&#xA;

    When I try to get the info about the video (ffprobe stockholm.yuv) I get the following :

    &#xA;&#xA;

    &#xA;

    [IMGUTILS @ 0x7fff5bac8140] Picture size 0x0 is invalid
    &#xA; [IMGUTILS @ 0x7fff5bac8150] Picture size 0x0 is invalid
    &#xA; [rawvideo @ 0x7fbcb200da00] Could not find codec parameters for stream 0 (Video : rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s) : unspecified size
    &#xA; Consider increasing the value for the 'analyzeduration' and 'probesize' options&#xA; stockholm.yuv : Operation not permitted`

    &#xA;

    &#xA;&#xA;

    Does anyone have any idea ?

    &#xA;