Recherche avancée

Médias (0)

Mot : - Tags -/médias

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (55)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (8262)

  • While using skvideo.io.FFmpegReader and skvideo.io.FFmpegWriter for video throughput the input video and output video length differ

    28 juin 2024, par Kaesebrotus Anonymous

    I have an h264 encoded mp4 video of about 27.5 minutes length and I am trying to create a copy of the video which excludes the first 5 frames. I am using scikit-video and ffmpeg in python for this purpose. I do not have a GPU, so I am using libx264 codec for the output video.

    


    It generally works and the output video excludes the first 5 frames. Somehow, the output video results in a length of about 22 minutes. When visually checking the videos, the shorter video does seem slightly faster and I can identify the same frames at different timestamps. In windows explorer, when clicking properties and then details, both videos' frame rates show as 20.00 fps.

    


    So, my goal is to have both videos of the same length, except for the loss of the first 5 frames which should result in a duration difference of 0.25 seconds, and use the same (almost same) codec and not lose quality.

    


    Can anyone explain why this apparent loss of frames is happening ?

    


    Thank you for your interest in helping me, please find the details below.

    


    Here is a minimal example of what I have done.

    


    framerate = str(20)
reader = skvideo.io.FFmpegReader(inputvideo.mp4, inputdict={'-r': framerate})
writer = skvideo.io.FFmpegWriter(outputvideo.mp4, outputdict={'-vcodec': 'libx264', '-r': framerate})

for idx,frame in enumerate(reader.nextFrame()):
    if idx < 5:
        continue
    writer.writeFrame(frame)

reader.close()
writer.close()


    


    When I read the output video again using FFmpegReader and check the .probeInfo, I can see that the output video has less frames in total. I have also managed to replicate the same problem for shorter videos (now not excluding the first 5 frames, but only throughputting a video), e.g. 10 seconds input turns to 8 seconds output with less frames. I have also tried playing around with further parameters of the outputdict, e.g. -pix_fmt, -b. I have tried to set -time_base in the output dict to the same value as in the inputdict, but that did not seem to have the desired effect. I am not sure if the name of the parameter is right.

    


    For additional info, I am providing the .probeInfo of the input video, of which I used 10 seconds, and the .probeInfo of the 8 second output video it produced.

    


    **input video** .probeInfo:
input dict

{'video': OrderedDict([('@index', '0'),
              ('@codec_name', 'h264'),
              ('@codec_long_name',
               'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10'),
              ('@profile', 'High 4:4:4 Predictive'),
              ('@codec_type', 'video'),
              ('@codec_tag_string', 'avc1'),
              ('@codec_tag', '0x31637661'),
              ('@width', '4096'),
              ('@height', '3000'),
              ('@coded_width', '4096'),
              ('@coded_height', '3000'),
              ('@closed_captions', '0'),
              ('@film_grain', '0'),
              ('@has_b_frames', '0'),
              ('@sample_aspect_ratio', '1:1'),
              ('@display_aspect_ratio', '512:375'),
              ('@pix_fmt', 'yuv420p'),
              ('@level', '60'),
              ('@chroma_location', 'left'),
              ('@field_order', 'progressive'),
              ('@refs', '1'),
              ('@is_avc', 'true'),
              ('@nal_length_size', '4'),
              ('@id', '0x1'),
              ('@r_frame_rate', '20/1'),
              ('@avg_frame_rate', '20/1'),
              ('@time_base', '1/1200000'),
              ('@start_pts', '0'),
              ('@start_time', '0.000000'),
              ('@duration_ts', '1984740000'),
              ('@duration', '1653.950000'),
              ('@bit_rate', '3788971'),
              ('@bits_per_raw_sample', '8'),
              ('@nb_frames', '33079'),
              ('@extradata_size', '43'),
              ('disposition',
               OrderedDict([('@default', '1'),
                            ('@dub', '0'),
                            ('@original', '0'),
                            ('@comment', '0'),
                            ('@lyrics', '0'),
                            ('@karaoke', '0'),
                            ('@forced', '0'),
                            ('@hearing_impaired', '0'),
                            ('@visual_impaired', '0'),
                            ('@clean_effects', '0'),
                            ('@attached_pic', '0'),
                            ('@timed_thumbnails', '0'),
                            ('@non_diegetic', '0'),
                            ('@captions', '0'),
                            ('@descriptions', '0'),
                            ('@metadata', '0'),
                            ('@dependent', '0'),
                            ('@still_image', '0')])),
              ('tags',
               OrderedDict([('tag',
                             [OrderedDict([('@key', 'language'),
                                           ('@value', 'und')]),
                              OrderedDict([('@key', 'handler_name'),
                                           ('@value', 'VideoHandler')]),
                              OrderedDict([('@key', 'vendor_id'),
                                           ('@value', '[0][0][0][0]')])])]))])}

**output video** .probeInfo:
{'video': OrderedDict([('@index', '0'),
              ('@codec_name', 'h264'),
              ('@codec_long_name',
               'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10'),
              ('@profile', 'High'),
              ('@codec_type', 'video'),
              ('@codec_tag_string', 'avc1'),
              ('@codec_tag', '0x31637661'),
              ('@width', '4096'),
              ('@height', '3000'),
              ('@coded_width', '4096'),
              ('@coded_height', '3000'),
              ('@closed_captions', '0'),
              ('@film_grain', '0'),
              ('@has_b_frames', '2'),
              ('@pix_fmt', 'yuv420p'),
              ('@level', '60'),
              ('@chroma_location', 'left'),
              ('@field_order', 'progressive'),
              ('@refs', '1'),
              ('@is_avc', 'true'),
              ('@nal_length_size', '4'),
              ('@id', '0x1'),
              ('@r_frame_rate', '20/1'),
              ('@avg_frame_rate', '20/1'),
              ('@time_base', '1/10240'),
              ('@start_pts', '0'),
              ('@start_time', '0.000000'),
              ('@duration_ts', '82944'),
              ('@duration', '8.100000'),
              ('@bit_rate', '3444755'),
              ('@bits_per_raw_sample', '8'),
              ('@nb_frames', '162'),
              ('@extradata_size', '47'),
              ('disposition',
               OrderedDict([('@default', '1'),
                            ('@dub', '0'),
                            ('@original', '0'),
                            ('@comment', '0'),
                            ('@lyrics', '0'),
                            ('@karaoke', '0'),
                            ('@forced', '0'),
                            ('@hearing_impaired', '0'),
                            ('@visual_impaired', '0'),
                            ('@clean_effects', '0'),
                            ('@attached_pic', '0'),
                            ('@timed_thumbnails', '0'),
                            ('@non_diegetic', '0'),
                            ('@captions', '0'),
                            ('@descriptions', '0'),
                            ('@metadata', '0'),
                            ('@dependent', '0'),
                            ('@still_image', '0')])),
              ('tags',
               OrderedDict([('tag',
                             [OrderedDict([('@key', 'language'),
                                           ('@value', 'und')]),
                              OrderedDict([('@key', 'handler_name'),
                                           ('@value', 'VideoHandler')]),
                              OrderedDict([('@key', 'vendor_id'),
                                           ('@value', '[0][0][0][0]')]),
                              OrderedDict([('@key', 'encoder'),
                                           ('@value',
                                            'Lavc61.8.100 libx264')])])]))])}


    


    I used 10 seconds by adding this to the bottom of the loop shown above :

    


        if idx >= 200:
        break


    


  • Setting getChannelData causing socket.io to crash in web audio

    6 novembre 2014, par Brad.Smith

    I’m having an issue where whenever I transcode an audio file and send the audio buffer to the client via socket.io to be played by web audio my connection dies as soon as I perform

    source.buffer.getChannelData(0).set(audio);

    I’m assuming that this isn’t a Socket.IO problem and that I’m only seeing the Socket.IO issue as a result of the real problem. In the client I’m piping the audio file into stdin of ffmpeg and listening to stderr of ffmpeg to determine when it’s safe to send the buffer. The client is receiving the buffer and is doing everything properly until the line stated above. Here is some sample test code to reproduce the issue.

    Server side :

    var express = require('express');
    var http = require('http');
    var spawn = require('child_process').spawn;

    var app       = express();
    var webServer = http.createServer(app);
    var io        = require('socket.io').listen(webServer, {log: false});

    app.use(express.static(__dirname + '/public'));

    app.get('/', function(req, res){
       res.send(
       "<code class="echappe-js">&lt;script src='http://stackoverflow.com/socket.io/socket.io.js'&gt;&lt;/script&gt;

    \n"+
    "&lt;script&gt;var socket=io.connect('http://127.0.0.1:3000');&lt;/script&gt;\n"+
    "&lt;script src='http://stackoverflow.com/webaudio_file_cli.js'&gt;&lt;/script&gt;"
    ) ;
    ) ;
    webServer.listen(3000) ;

    io.sockets.on(’connection’, function(webSocket)

    var disconnect = ’0’ ;
    var count = 0 ;
    var audBuf = new Buffer([]) ;

    if (disconnect == ’0’)
    console.log(’new connection...’) ;

    var inputStream = spawn(’wget’, [’-O’,’-’,’http://www.noiseaddicts.com/samples/4353.mp3’]) ;

    var ffmpeg = spawn(’ffmpeg’, [
    ’-i’, ’pipe:0’, // Input on stdin
    ’-acodec’, ’pcm_s16le’, // PCM 16bits, little-endian
    ’-ar’, ’24000’, // Sampling rate
    ’-ac’, 1, // Mono
    ’-f’, ’wav’,
    ’pipe:1’ // Output on stdout
    ], stdio : [’pipe’,’pipe’,’pipe’]) ;

    inputStream.stdout.pipe(ffmpeg.stdin) ;

    ffmpeg.stdout.on(’data’, function(data)
    audBuf = Buffer.concat([audBuf,data]) ;
    ) ;

    ffmpeg.stderr.on(’data’, function(data)
    var _line = data.toString(’utf8’) ;
    if (_line.substring(0,5) == ’size=’ && _line.indexOf(’headers :’) > -1)
    console.log(’completed...’) ;
    webSocket.emit(’audio’,audBuf) ;

    ) ;

    webSocket.on(’disconnect’, function()
    console.log(’disconnecting...’) ;
    disconnect=1 ;
    ) ;
    ) ;

    Client side (webaudio_file_cli.js) :

    window.AudioContext = window.AudioContext || window.webkitAudioContext;
    var context = new AudioContext();
    var source = context.createBufferSource();

    var audioStack = [], audio = [];

    socket.on('audio', function(data) {
       playAudio(data);
    });

    function playAudio(data) {
       // playback starting...
       audioStack = Int16Array(data);
       for (var i = 0; i &lt; audioStack.length; i++) {
           audio[i] = (audioStack[i]>0)?audioStack[i]/32767:audioStack[i]/32768; // convert buffer to within the range -1.0 -> +1.0
       }

       var audioBuffer = context.createBuffer(1, audio.length, 24000);
       source.buffer.getChannelData(0).set(audio);
       source.buffer = audioBuffer;
       source.connect(context.destination);
       source.start(0);
    }
  • Why ffmpeg ignores output fps ?

    22 novembre 2023, par Thomas Carlton

    I have the following ffmpeg command that streams an input to an RTMP endpoint :

    &#xA;

    ffmpeg &#xA;    -re &#xA;    -i - &#xA;    -r 30 &#xA;    -vf scale=852:480 &#xA;    -c:v libx264 &#xA;    -pix_fmt yuv420p &#xA;    -profile:v main &#xA;    -preset veryfast &#xA;    -x264opts "nal-hrd=cbr:no-scenecut" &#xA;    -minrate 3000 &#xA;    -maxrate 3000 &#xA;    -g 60 &#xA;    -c:a aac &#xA;    -b:a 160k &#xA;    -ac 2 &#xA;    -ar 44100 &#xA;    -f flv &#xA;    Some RTMPURL/ Some RTMPKey&#xA;

    &#xA;

    This command works but the output frame rate is not respected. It drops to 6 fps. I need it to be always 30 fps.

    &#xA;

    Why is it not respected ?

    &#xA;