Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (40)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (5863)

  • Ffmpeg send duration of video to client (using node-fluent-ffmpeg)

    26 mai 2013, par Vprnl

    I'm really new to the world of ffmpeg so please excuses me if this is a stupid queston.

    I'm using the module Node-fluent-ffmpeg to stream a movie and convert it from avi to webm with FFMPEG.

    So far so good (it plays the video), but I'm having trouble parsing the duration to the player. It also gives me an error even though I plays the video.

    my code is as followed :

    var stat = fs.statSync(movie);

    var start = 0;
    var end = 0;
    var range = req.header('Range');
    if (range != null) {
    start = parseInt(range.slice(range.indexOf('bytes=')+6,
     range.indexOf('-')));
    end = parseInt(range.slice(range.indexOf('-')+1,
     range.length));
    }
    if (isNaN(end) || end == 0) end = stat.size-1;
    if (start > end) return;

    var duration = (end / 1024) * 8 / 1024;

    res.writeHead(206, { // NOTE: a partial http response
       'Connection':'close',
       'Content-Type':'video/webm',
       'Content-Length':end - start,
       'Content-Range':'bytes '+start+'-'+end+'/'+stat.size,
       'Transfer-Encoding':'chunked'
    });

    var proc = new ffmpeg({ source: movie, nolog: true, priority: 1, timeout:15000})
       .toFormat('webm')
       .addOptions(['-probesize 900000', '-analyzeduration 0', '-minrate 1024k', '-maxrate 1024k', '-bufsize 1835k', '-t '+duration+' -ss'])
       .writeToStream(res, function(retcode, error){
       if (!error){
           console.log('file has been converted succesfully',retcode);
       }else{
           console.log('file conversion error',error);
       }
    });

    I set the header with a start and a end based on this article : http://delog.wordpress.com/2011/04/25/stream-webm-file-to-chrome-using-node-js/

    I calculate the length in seconds in the variable duration.

    The error FFmpeg is giving me is :

       file conversion error ffmpeg version N-52458-gaa96439 Copyright (c) 2000-2013 the FFmpeg developers
         built on Apr 24 2013 22:19:32 with gcc 4.8.0 (GCC)
         configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --e
       nable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable
       -libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --ena
       ble-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwola
       me --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enabl
       e-libxvid --enable-zlib
         libavutil      52. 27.101 / 52. 27.101
         libavcodec     55.  6.100 / 55.  6.100
         libavformat    55.  3.100 / 55.  3.100
         libavdevice    55.  0.100 / 55.  0.100
         libavfilter     3. 60.101 /  3. 60.101
         libswscale      2.  2.100 /  2.  2.100
         libswresample   0. 17.102 /  0. 17.102
         libpostproc    52.  3.100 / 52.  3.100
       Input #0, avi, from 'C:/temp/test.avi':
         Metadata:
           encoder         : Nandub v1.0rc2
         Duration: 00:01:09.78, start: 0.000000, bitrate: 1517 kb/s
           Stream #0:0: Video: msmpeg4v3 (DIV3 / 0x33564944), yuv420p, 640x352, 23.98 tbr, 23.98 tbn, 23.98 tbc
           Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 222 kb/s
       [libvpx @ 0036db20] v1.2.0
       Output #0, webm, to 'pipe:1':
         Metadata:
           encoder         : Lavf55.3.100
           Stream #0:0: Video: vp8, yuv420p, 640x352, q=-1--1, 200 kb/s, 1k tbn, 23.98 tbc
           Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp
       Stream mapping:
         Stream #0:0 -> #0:0 (msmpeg4 -> libvpx)
         Stream #0:1 -> #0:1 (mp3 -> libvorbis)

    The client side player (which is VideoJs) says the file is infinite/NaN in length.

    I feel like I'm pretty close to a solution but my inexperience with the subject matter prohibits me from getting it to work. If I'm unclear in any way please let me know. (I have a tendency of explaining things fuzzy.)

    Thanks in advance !

    [EDIT]

    I removed the duration bit because it has nothing to do with the issue. I checked the response header of the client and saw :

    Accept-Ranges:bytes
    Connection:keep-alive
    Content-Length:13232127
    Content-Range:bytes 0-13232127/13232128
    Content-Type:video/webm

    Why can't the client figure out the duration even though it receives it in the header ?

  • Ffmpeg set duration using node-fluent-ffmpeg

    23 mai 2013, par Vprnl

    I'm really new to the world of ffmpeg so please excuses me if this is a stupid queston.

    I'm using the module Node-fluent-ffmpeg to stream a movie and convert it from avi to webm.
    So far so good (it plays the video), but I'm having trouble parsing the duration to the player. My ultimate goal is to be able to skip ahead in the movie. But first the player needs to know how long the video is.

    my code is as followed :

    var stat = fs.statSync(movie);

    var start = 0;
    var end = 0;
    var range = req.header('Range');
    if (range != null) {
    start = parseInt(range.slice(range.indexOf('bytes=')+6,
     range.indexOf('-')));
    end = parseInt(range.slice(range.indexOf('-')+1,
     range.length));
    }
    if (isNaN(end) || end == 0) end = stat.size-1;
    if (start > end) return;

    res.writeHead(206, { // NOTE: a partial http response
       'Connection':'close',
       'Content-Type':'video/webm',
       'Content-Length':end - start,
       'Content-Range':'bytes '+start+'-'+end+'/'+stat.size,
       'Transfer-Encoding':'chunked'
    });

    var  proc = new ffmpeg({ source: movie, nolog: true, priority: 1, timeout:15000})
       .toFormat('webm')
       .withVideoBitrate('1024k')
       .addOptions(['-probesize 900000', '-analyzeduration 0', '-bufsize 14000'])
       .writeToStream(res, function(retcode, error){
       if (!error){
           console.log('file has been converted succesfully',retcode);
       }else{
           console.log('file conversion error',error);
       }
    });

    I tried to set the header with a start and a end based on this article : http://delog.wordpress.com/2011/04/25/stream-webm-file-to-chrome-using-node-js/

    I also looked in the FFmpeg documentation and found -f duration and -ss.
    But I don't quite know how to convert the byte range to seconds.

    I feel like I'm pretty close to a solution but my inexperience with the subject matter prohibits me from getting it to work. If I'm unclear in any way please let me know. (I have a tendency of explaining things fuzzy.)

    Thanks in advance !

  • Convert MPEG4 to MPEGTS on Android with FFmpeg

    3 juin 2013, par Ardoramor

    Ok, so obviously I know very little to none about ffmpeg API when I made the original post... it is quite overwhelming when one starts learning about digital media and conversion details. After reading quite a bit more and going through ffmpeg source, I was able to get a working output from mp4 to mpegts. The concept is similar to executing :

    ffmpeg -i in.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb out.ts

    But as I mentioned before, I need to implement it with ffmpeg API in C.

    So, although I am able to generate a playable .ts file, its video and audio streams are not synced. That is, playing them back on Android tablet plays the video very slowly while audio is playing at normal speed and then (once audio stream ends) video plays at normal speed to the end. Playing the same generated .ts file in VLC produces a very condensed audio (as though fast-forwarded) and plays video fine.

    There are still many aspects of media conversion that I am not familiar with. I am sure that some of them prevent me from successful conversion.

    Here is some information (via ffprobe) about the files :
    - in.mp4 - file generated via Android recording - MPEG4 (H.264 + AAC)
    - ffmpeg.ts - file generated via ffmpeg conversion - MPEG2TS (H.264 + AAC)
    - out.ts - file generated via my code - MPEGTS (H.264 + AAC)

    in.mp4

    filename=in.mp4
    nb_streams=2
    format_name=mov,mp4,m4a,3gp,3g2,mj2
    format_long_name=QuickTime/MPEG-4/Motion JPEG 2000 format
    start_time=0:00:00.000000
    duration=0:00:09.961383
    size=4.730 Mibyte
    bit_rate=3.983 Mbit/s
    TAG:major_brand=isom
    TAG:minor_version=0
    TAG:compatible_brands=isom3gp4
    TAG:creation_time=2013-05-28 17:06:57

    ffmpeg.ts

    filename=ffmpeg.ts
    nb_streams=2
    format_name=mpegts
    format_long_name=MPEG-2 transport stream format
    start_time=0:00:01.400000
    duration=0:00:09.741267
    size=5.132 Mibyte
    bit_rate=4.419 Mbit/s

    out.ts

    filename=out.ts
    nb_streams=2
    format_name=mpegts
    format_long_name=MPEG-2 transport stream format
    start_time=0:00:00.000000
    duration=0:00:09.741267
    size=5.166 Mibyte
    bit_rate=4.449 Mbit/s

    Firstly, I was unable to affect my output file's start_time. Next, upon examining the -show_packets output of probe, I saw the following :

    ffmpeg.ts

    [PACKET]
    codec_type=video
    stream_index=0
    pts=N/A
    pts_time=N/A
    dts=N/A
    dts_time=N/A
    duration=0
    duration_time=0:00:00.000000
    size=20.506 Kibyte
    pos=564
    flags=K
    [/PACKET]
    [PACKET]
    codec_type=video
    stream_index=0
    pts=N/A
    pts_time=N/A
    dts=N/A
    dts_time=N/A
    duration=0
    duration_time=0:00:00.000000
    size=11.727 Kibyte
    pos=22936
    flags=_
    [/PACKET]
    ...
    [PACKET]
    codec_type=audio
    stream_index=1
    pts=126000
    pts_time=0:00:01.400000
    dts=126000
    dts_time=0:00:01.400000
    duration=2089
    duration_time=0:00:00.023211
    size=285.000 byte
    pos=109416
    flags=K
    [/PACKET]
    [PACKET]
    codec_type=audio
    stream_index=1
    pts=128089
    pts_time=0:00:01.423211
    dts=128089
    dts_time=0:00:01.423211
    duration=2089
    duration_time=0:00:00.023211
    size=374.000 byte
    pos=-1
    flags=K
    [/PACKET]
    ...
    [PACKET]
    codec_type=video
    stream_index=0
    pts=N/A
    pts_time=N/A
    dts=N/A
    dts_time=N/A
    duration=0
    duration_time=0:00:00.000000
    size=20.000 Kibyte
    pos=87232
    flags=_
    [/PACKET]
    [PACKET]
    codec_type=video
    stream_index=0
    pts=N/A
    pts_time=N/A
    dts=N/A
    dts_time=N/A
    duration=0
    duration_time=0:00:00.000000
    size=16.852 Kibyte
    pos=112800
    flags=_
    [/PACKET]

    out.ts

    [PACKET]
    codec_type=audio
    stream_index=1
    pts=0
    pts_time=0:00:00.000000
    dts=0
    dts_time=0:00:00.000000
    duration=2089
    duration_time=0:00:00.023211
    size=285.000 byte
    pos=22936
    flags=K
    [/PACKET]
    [PACKET]
    codec_type=audio
    stream_index=1
    pts=1024
    pts_time=0:00:00.011378
    dts=1024
    dts_time=0:00:00.011378
    duration=2089
    duration_time=0:00:00.023211
    size=374.000 byte
    pos=23312
    flags=K
    [/PACKET]
    ...

    [PACKET]
    codec_type=video
    stream_index=0
    pts=N/A
    pts_time=N/A
    dts=N/A
    dts_time=N/A
    duration=0
    duration_time=0:00:00.000000
    size=11.727 Kibyte
    pos=25004
    flags=_
    [/PACKET]
    [PACKET]
    codec_type=audio
    stream_index=1
    pts=7168
    pts_time=0:00:00.079644
    dts=7168
    dts_time=0:00:00.079644
    duration=2089
    duration_time=0:00:00.023211
    size=299.000 byte
    pos=55460
    flags=K
    [/PACKET]

    As you can see, ffmpeg.ts starts out with video packets that do not have pts/dts. The audio packets that follow contain pts/dts. This repeats until the end. All video packets do not have pts/dts according to ffprobe output.

    However, out.ts starts with audio packets and alternate with video packets. Here, video packets also do not have pts/dts. The difference is that here there is one video packet between a series of audio packets. What happened to the rest of the video packets (ffmpeg.ts has 5 audio followed by 5 video).

    Obviously, I'm still learning and don't know way too much yet... Does anything jump out as obvious a problem to anyone ? I will greatly appreciate any info / suggestions but will continue to grind at it !!