Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (97)

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

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (10077)

  • Creating GIF from QImages with ffmpeg

    17 août 2016, par Sierra

    I would like to generate GIF from QImage, using ffmpeg - all of that programmatically (C++). I’m working with Qt 5.6 and the last build of ffmpeg (build git-0a9e781 (2016-06-10).

    I’m already able to convert these QImage in .mp4 and it works. I tried to use the same principle for the GIF, changing format pixel and codec. GIF is generated with two pictures (1 second each), in 15 FPS.

    ## INITIALIZATION
    #####################################################################

    // Filepath : "C:/Users/.../qt_temp.Jv7868.gif"  
    // Allocating an AVFormatContext for an output format...
    avformat_alloc_output_context2(formatContext, NULL, NULL, filepath);

    ...

    // Adding the video streams using the default format codecs and initializing the codecs.
    stream = avformat_new_stream(formatContext, *codec);

    AVCodecContext * codecContext = avcodec_alloc_context3(*codec);

    context->codec_id       = codecId;
    context->bit_rate       = 400000;
    ...
    context->pix_fmt        = AV_PIX_FMT_BGR8;

    ...

    // Opening the codec...
    avcodec_open2(codecContext, codec, NULL);

    ...

    frame = allocPicture(codecContext->width, codecContext->height, codecContext->pix_fmt);
    tmpFrame = allocPicture(codecContext->width, codecContext->height, AV_PIX_FMT_RGBA);

    ...

    avformat_write_header(formatContext, NULL);

    ## ADDING A NEW FRAME
    #####################################################################

    // Getting in parameter the QImage: newFrame(const QImage & image)
    const qint32 width  = image.width();
    const qint32 height = image.height();

    // Converting QImage into AVFrame
    for (qint32 y = 0; y < height; y++) {
       const uint8_t * scanline = image.scanLine(y);

       for (qint32 x = 0; x < width * 4; x++) {
           tmpFrame->data[0][y * tmpFrame->linesize[0] + x] = scanline[x];
       }
    }

    ...

    // Scaling...
    if (codec->pix_fmt != AV_PIX_FMT_BGRA) {
       if (!swsCtx) {
           swsCtx = sws_getContext(codec->width, codec->height,
                                   AV_PIX_FMT_BGRA,
                                   codec->width, codec->height,
                                   codec->pix_fmt,
                                   SWS_BICUBIC, NULL, NULL, NULL);
       }

       sws_scale(swsCtx,
                 (const uint8_t * const *)tmpFrame->data,
                 tmpFrame->linesize,
                 0,
                 codec->height,
                 frame->data,
                 frame->linesize);
    }
    frame->pts = nextPts++;

    ...

    int gotPacket = 0;
    AVPacket packet = {0};

    av_init_packet(&packet);
    avcodec_encode_video2(codec, &packet, frame, &gotPacket);

    if (gotPacket) {
       av_packet_rescale_ts(paket, *codec->time_base, stream->time_base);
       paket->stream_index = stream->index;

       av_interleaved_write_frame(formatContext, paket);
    }

    But when I’m trying to modify the video codec and pixel format to match with GIF specifications, I’m facing some issues.
    I tried several codecs such as AV_CODEC_ID_GIF and AV_CODEC_ID_RAWVIDEO but none of them seem to work. During the initialization phase, avcodec_open2() always returns such kind of errors :

    Specified pixel format rgb24 is invalid or not supported
    Could not open video codec:  gif

    EDIT 17/06/2016

    Digging a little bit more, avcodec_open2() returns -22 :

    #define EINVAL          22      /* Invalid argument */

    EDIT 22/06/2016

    Here are the flags used to compile ffmpeg :

    "FFmpeg/Libav configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib"

    Did I miss a crucial one for GIF ?

    EDIT 27/06/2016

    Thanks to Gwen, I have a first output : I setted the context->pix_fmt to AV_PIX_FMT_BGR8. Btw I’m still facing some issues with the generated GIF. It’s not playing and encoding appears to fail.

    GIF generated in command lines with ffmpeg (left) . . . GIF generated programmatically (right)
    Generated in command line with ffmpeg
    enter image description here

    It looks like some options are not defined... also may be a wrong conversion between QImage and AVFrame ? I updated the code above. It represents a lot of code, so I tried to stay short. Don’t hesitate to ask more details.

    End of EDIT

    I’m not really familiar with ffmpeg, any kind of help would be highly appreciated. Thank you.

  • (osx) ffmpeg combining mp3 and png to mp4 resulting in mp4 with no audio

    18 juin 2016, par Ian H

    I’m writing a python script that uses unix commands to do some file conversions/renderings. I’m trying to join some mp3 files with png files to get mp4s that are the picture with the mp3 playing over them. However, I’ve tried this with lots of different codecs and settings, and the output mp4 video never seems to have audio in it. I’ve looked at any answer to any question even related to ffmpeg and haven’t found a solution.

    Some commands I’m trying to get working currently :

    ffmpeg -loop 1 -i slide_shot%d.png -i %s -c:v libx264 -pix_fmt yuv420p
    -s 720x540 -t %.3f -c:a aac -b:a 192k -shortest out%d.mp4"
    % (i, aud, slideTime, i)

    ffmpeg -loop 1 -i slide_shot%d.png -i %s -shortest -t %.3f -write_xing
    0 -c:v libx264 -c:a libmp3lame -pix_fmt yuv420p -tune stillimage out%d.mp4"
    % (i, aud, slideTime, i)

    ffmpeg -loop 1 -i slide_shot%d.png -i %s -shortest -t %.3f -write_xing
    0 -c:v libx264 -c:a copy -pix_fmt yuv420p -tune stillimage out%d.mp4"
    % (i, aud, slideTime, i)

    I’m currently using the third one. However, none of them are giving me any audio. For reference, i is a loop iterator for naming consistency, aud is the audio filepath, and slideTime is the number of seconds the video should take.

    Using this command, I’m currently getting this output in the Terminal :

    ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
    built with Apple LLVM version 7.0.2 (clang-700.1.81)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared    
    --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-
    tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --
    enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --
    enable-vda
    libavutil      55. 17.103 / 55. 17.103
    libavcodec     57. 24.102 / 57. 24.102
    libavformat    57. 25.100 / 57. 25.100
    libavdevice    57.  0.101 / 57.  0.101
    libavfilter     6. 31.100 /  6. 31.100
    libavresample   3.  0.  0 /  3.  0.  0
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.101 /  2.  0.101
    libpostproc    54.  0.100 / 54.  0.100
    Input #0, png_pipe, from 'slide_shot16.png':
    Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 720x540, 25 fps, 25 tbr, 25 tbn, 25    
    tbc
    [mp3 @ 0x7fe4f1817e00] Skipping 0 bytes of junk at 0.
    [mp3 @ 0x7fe4f1817e00] Estimating duration from bitrate, this may be inaccurate
    Input #1, mp3, from 'pres_projects/Cytokine sepsis 13/data/a24x43.mp3':
    Duration: 00:02:04.11, start: 0.000000, bitrate: 23 kb/s
    Stream #1:0: Audio: mp3, 22050 Hz, mono, s16p, 24 kb/s
    [libx264 @ 0x7fe4f1808000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x7fe4f1808000] profile High, level 3.0
    [libx264 @ 0x7fe4f1808000] 264 - core 148 r2668 fd2c324 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-3:-3 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=2.00:0.70 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-4 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.20
    Output #0, mp4, to 'out16.mp4':
    Metadata:
    encoder         : Lavf57.25.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x540, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
     encoder         : Lavc57.24.102 libx264
    Side data:
     unknown side data type 10 (24 bytes)
    Stream #0:1: Audio: mp3 (i[0][0][0] / 0x0069), 22050 Hz, mono, 24 kb/s
    Stream mapping:
    Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
    Stream #1:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=  132 fps=0.0 q=28.0 size=40kB time=00:00:02.96 bitrate=111.8kbits/
    frame=  272 fps=271 q=28.0 size=      61kB time=00:00:08.56 bitrate=  58.2kbits/
    frame=  404 fps=269 q=28.0 size=     113kB time=00:00:13.84 bitrate=  66.6kbits/
    frame=  537 fps=268 q=28.0 size=     132kB time=00:00:19.16 bitrate=  56.2kbits/
    frame=  672 fps=268 q=28.0 size=     184kB time=00:00:24.56 bitrate=  61.3kbits/
    frame=  808 fps=268 q=28.0 size=     236kB time=00:00:30.00 bitrate=  64.5kbits/
    frame=  943 fps=268 q=28.0 size=     255kB time=00:00:35.40 bitrate=  59.1kbits/
    frame= 1087 fps=271 q=28.0 size=     309kB time=00:00:41.16 bitrate=  61.5kbits/
    frame= 1219 fps=270 q=28.0 size=     328kB time=00:00:46.44 bitrate=  57.8kbits/
    frame= 1355 fps=270 q=28.0 size=     380kB time=00:00:51.88 bitrate=  60.0kbits/frame= 1494 fps=271 q=28.0 size=     400kB time=00:00:57.44 bitrate=  57.1kbits/
    frame= 1632 fps=271 q=28.0 size=     453kB time=00:01:02.96 bitrate=  58.9kbits/
    frame= 1767 fps=271 q=28.0 size=     472kB time=00:01:08.36 bitrate=  56.6kbits/
    frame= 1893 fps=269 q=28.0 size=     523kB time=00:01:13.40 bitrate=  58.4kbits/
    frame= 2020 fps=268 q=28.0 size=     541kB time=00:01:18.48 bitrate=  56.5kbits/
    frame= 2147 fps=267 q=28.0 size=     592kB time=00:01:23.56 bitrate=  58.1kbits/
    frame= 2275 fps=267 q=28.0 size=     611kB time=00:01:28.68 bitrate=  56.4kbits/
    frame= 2401 fps=266 q=28.0 size=     661kB time=00:01:33.72 bitrate=  57.8kbits/
    frame= 2528 fps=265 q=28.0 size=     680kB time=00:01:38.80 bitrate=  56.4kbits/
    frame= 2654 fps=264 q=28.0 size=     731kB time=00:01:43.84 bitrate=  57.6kbits/
    frame= 2781 fps=264 q=28.0 size=     749kB time=00:01:48.92 bitrate=  56.3kbits/
    frame= 2906 fps=263 q=28.0 size=     799kB time=00:01:53.92 bitrate=  57.5kbits/
    frame= 3033 fps=263 q=28.0 size=     818kB time=00:01:59.00 bitrate=  56.3kbits/
    frame= 3102 fps=261 q=-1.0 Lsize=     983kB time=00:02:04.08 bitrate=  64.9kbits/s speed=10.5x    
    video:505kB audio:364kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 13.169518%
    [libx264 @ 0x7fe4f1808000] frame I:13    Avg QP:14.07  size: 33159
    [libx264 @ 0x7fe4f1808000] frame P:782   Avg QP: 6.24  size:    36
    [libx264 @ 0x7fe4f1808000] frame B:2307  Avg QP: 9.67  size:    25
    [libx264 @ 0x7fe4f1808000] consecutive B-frames:  0.8%  0.0%  0.0% 9 9.2%
    [libx264 @ 0x7fe4f1808000] mb I  I16..4: 44.1% 26.2% 29.6%
    [libx264 @ 0x7fe4f1808000] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
    [libx264 @ 0x7fe4f1808000] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0%  0.0%  direct: 0.0%  skip:99.9%  L0:40.4% L1:59.6% BI: 0.0%
    [libx264 @ 0x7fe4f1808000] 8x8 transform intra:26.1% inter:77.7%
    [libx264 @ 0x7fe4f1808000] coded y,uvDC,uvAC intra: 23.8% 9.6% 8.1% inter: 0.0% 0.0% 0.0%
    [libx264 @ 0x7fe4f1808000] i16 v,h,dc,p: 60% 33%  7%  0%
    [libx264 @ 0x7fe4f1808000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 57% 12% 29%  0%  0%  0%  0%  0%  2%
    [libx264 @ 0x7fe4f1808000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 29% 14%  2%  3%  4%  4%  3%  4%
    [libx264 @ 0x7fe4f1808000] i8c dc,h,v,p: 74% 21%  5%  0%
    [libx264 @ 0x7fe4f1808000] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x7fe4f1808000] ref P L0: 95.4%  1.1%  3.5%
    [libx264 @ 0x7fe4f1808000] ref B L0:  8.5% 90.2%  1.3%
    [libx264 @ 0x7fe4f1808000] kb/s:33.31

    Has anyone ran into a similar problem, and if so, how did you go about fixing it ? Thanks in advance for looking at my question.

  • Saving an animation using ffmpeg and matplotlib on anaconda3

    21 juin 2016, par Varsha Dyavaiah

    I am trying to create videos of NBA Action with Sportsvu data.

    I was following the steps given in this blog by Dan Vatterott :

    http://www.danvatterott.com/blog/2016/06/16/creating-videos-of-nba-action-with-sportsvu-data/?utm_campaign=Data%2BElixir&utm_medium=email&utm_source=Data_Elixir_84

    I am trying to create a animation and save it using ffmpeg and matplotlib.
    The code snippet is attached below.

    import matplotlib.animation as animation
    plt.rcParams['animation.ffmpeg_path'] = '/home/anaconda3/pkgs/ffmpeg-2.1.0-1/bin'

    fig = plt.figure(figsize=(15,7.5)) #create figure object
    ax = plt.gca() #create axis object

    draw_court([0,100,0,50]) #draw the court
    player_text = list(range(10)) #create player text vector
    player_circ = list(range(10)) #create player circle vector
    ball_circ = plt.Circle((0,0), 1.1, color=[1, 0.4, 0]) #create circle object for bal
    for i in list(range(10)): #create circle object and text object for each player
        col=['w','k'] if i<5 else ['k','w'] #color scheme
        player_circ[i] = plt.Circle((0,0), 2.2, facecolor=col[0],edgecolor='k') #player circle
        player_text[i] =   ax.text(0,0,'',color=col[1],ha='center',va='center') #player jersey # (text)

    ani = animation.FuncAnimation(fig, animate,  frames=np.arange(0,np.size(ball_xy,0)), init_func=init, blit=True, interval=5, repeat=False,\
                            save_count=0) #function for making video

    FFwriter = animation.FFMpegWriter()
    ani.save('Event_%d.mp4' % (search_id),dpi=100,writer = FFwriter,fps=25) #function for saving video
    plt.close('all') #close the plot

    When I try to save the animation ’ani’ , I get Errno 13 (Permission denied).

    ---------------------------------------------------------------------------
    PermissionError                           Traceback (most recent call last)
    in <module>()
        17
        18 FFwriter = animation.FFMpegWriter()
    ---> 19 ani.save('Event_%d.mp4' % (search_id),dpi=100,writer = FFwriter,fps=25) #function for saving video
    20 plt.close('all') #close the plot

    /home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs)
       799         # since GUI widgets are gone. Either need to remove extra code to
       800         # allow for this non-existant use case or find a way to make it work.
    --> 801         with writer.saving(self._fig, filename, dpi):
       802             for anim in all_anim:
       803                 # Clear the initial frame

    /home/anaconda3/lib/python3.5/contextlib.py in __enter__(self)
        57     def __enter__(self):
        58         try:
    ---> 59             return next(self.gen)
        60         except StopIteration:
        61             raise RuntimeError("generator didn't yield") from None

    /home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in saving(self, *args)
       192         '''
       193         # This particular sequence is what contextlib.contextmanager wants
    --> 194         self.setup(*args)
       195         yield
       196         self.finish()

    /home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in setup(self, fig, outfile, dpi, *args)
       182         # Run here so that grab_frame() can write the data to a pipe. This
       183         # eliminates the need for temp files.
    --> 184         self._run()
       185
       186     @contextlib.contextmanager

    /home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in _run(self)
       210                                       stdout=output, stderr=output,
       211                                       stdin=subprocess.PIPE,
    --> 212                                       creationflags=subprocess_creation_flags)
       213
       214     def finish(self):

    /home/anaconda3/lib/python3.5/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
       948                                 c2pread, c2pwrite,
       949                                 errread, errwrite,
    --> 950                                 restore_signals, start_new_session)
       951         except:
       952             # Cleanup if the child failed starting.

    /home/anaconda3/lib/python3.5/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
      1542                             else:
      1543                                 err_msg += ': ' + repr(orig_executable)
    -> 1544                     raise child_exception_type(errno_num, err_msg)
      1545                 raise child_exception_type(err_msg)
      1546

    PermissionError: [Errno 13] Permission denied
    </module>

    Can someone help me ? Thanks in advance.