Recherche avancée

Médias (91)

Autres articles (47)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (6835)

  • ffmpeg how to convert stereo to mono using audio pan filter [migrated]

    5 juin 2015, par John T

    From the documentation, it looks like this should work :

    ffmpeg -i input.mp4 -af "pan=1c|c0=.5*c0+.5*c1" output.mp4

    The output is a video with no sound. When I do ffprobe, it says theres a audio mono track, but its only 2kbps.

    However, when I do it this way though, it seems to work and produce a video with a mono track :

    ffmpeg -i input.mp4 -ac 1 output.mp4

    Does anyone know the reason why the first way isn’t working for me ?

    Thanks !

    Adding Console output

    ffmpeg output :

    ffmpeg -loglevel verbose -i video_tong_hua.mp4 -af "pan=1c|c0=.5*c0+.5*c1" output.mp4
    ffmpeg version 2.3.3 Copyright (c) 2000-2014 the FFmpeg developers
     built on Feb 25 2015 23:01:46 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
     libavutil      52. 92.100 / 52. 92.100
     libavcodec     55. 69.100 / 55. 69.100
     libavformat    55. 48.100 / 55. 48.100
     libavdevice    55. 13.102 / 55. 13.102
     libavfilter     4. 11.100 /  4. 11.100
     libavresample   1.  3.  0 /  1.  3.  0
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 19.100 /  0. 19.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, matroska,webm, from 'video_tong_hua.mp4':
     Metadata:
       encoder         : google
     Duration: 00:06:18.38, start: 0.000000, bitrate: 283 kb/s
       Stream #0:0: Video: vp8, yuv420p, 322x240, SAR 1:1 DAR 161:120, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
       Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp (default)
    [graph 0 input from stream 0:0 @ 0x7fc8235003a0] w:322 h:240 pixfmt:yuv420p tb:1/1000 fr:2997/100 sar:1/1 sws_param:flags=2
    [graph 1 input from stream 0:1 @ 0x7fc82340d320] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3
    [audio format for output stream 0:1 @ 0x7fc82340d880] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_pan_0' and the filter 'audio format for output stream 0:1'
    [Parsed_pan_0 @ 0x7fc82340da40] o0 = 0.5 i0 + 0.5 i1
    [auto-inserted resampler 0 @ 0x7fc82340ce40] ch:1 chl:1 channels fmt:fltp r:44100Hz -> ch:1 chl:mono fmt:s16 r:44100Hz
    [libx264 @ 0x7fc823826000] using SAR=1/1
    [libx264 @ 0x7fc823826000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x7fc823826000] profile High, level 1.3
    [libx264 @ 0x7fc823826000] 264 - core 142 r2455 021c0dc - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 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.00
    Output #0, mp4, to 'output.mp4':
     Metadata:
       encoder         : Lavf55.48.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 322x240 [SAR 1:1 DAR 161:120], q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc (default)
       Metadata:
         encoder         : Lavc55.69.100 libx264
       Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 128 kb/s (default)
       Metadata:
         encoder         : Lavc55.69.100 libfaac
    Stream mapping:
     Stream #0:0 -> #0:0 (vp8 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (vorbis (native) -> aac (libfaac))
    Press [q] to stop, [?] for help
    No more output streams to write to, finishing.e=00:06:06.87 bitrate= 132.5kbits/s    
    frame=11340 fps=992 q=-1.0 Lsize=    6514kB time=00:06:18.31 bitrate= 141.1kbits/s    
    video:5995kB audio:95kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 6.954813%
    Input file #0 (video_tong_hua.mp4):
     Input stream #0:0 (video): 11970 packets read (8625600 bytes); 11340 frames decoded;
     Input stream #0:1 (audio): 23356 packets read (4543310 bytes); 23355 frames decoded (16675392 samples);
     Total: 35326 packets (13168910 bytes) demuxed
    Output file #0 (output.mp4):
     Output stream #0:0 (video): 11340 frames encoded; 11340 packets muxed (6139214 bytes);
     Output stream #0:1 (audio): 16285 frames encoded (16675392 samples); 16286 packets muxed (97733 bytes);
     Total: 27626 packets (6236947 bytes) muxed
    [libx264 @ 0x7fc823826000] frame I:70    Avg QP:17.29  size:  7924
    [libx264 @ 0x7fc823826000] frame P:4501  Avg QP:21.54  size:  1006
    [libx264 @ 0x7fc823826000] frame B:6769  Avg QP:21.74  size:   156
    [libx264 @ 0x7fc823826000] consecutive B-frames: 16.7%  8.8%  7.4% 67.1%
    [libx264 @ 0x7fc823826000] mb I  I16..4: 37.6% 29.0% 33.4%
    [libx264 @ 0x7fc823826000] mb P  I16..4:  1.9%  2.5%  0.7%  P16..4: 23.3%  8.0%  4.1%  0.0%  0.0%    skip:59.4%
    [libx264 @ 0x7fc823826000] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 17.1%  1.2%  0.2%  direct: 0.8%  skip:80.6%  L0:42.2% L1:52.9% BI: 4.8%
    [libx264 @ 0x7fc823826000] 8x8 transform intra:44.2% inter:55.4%
    [libx264 @ 0x7fc823826000] coded y,uvDC,uvAC intra: 33.9% 47.6% 18.3% inter: 5.4% 4.5% 1.1%
    [libx264 @ 0x7fc823826000] i16 v,h,dc,p: 57% 24% 16%  3%
    [libx264 @ 0x7fc823826000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 18% 43%  3%  3%  4%  3%  4%  4%
    [libx264 @ 0x7fc823826000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 30% 14%  4%  6%  6%  6%  5%  5%
    [libx264 @ 0x7fc823826000] i8c dc,h,v,p: 51% 30% 17%  3%
    [libx264 @ 0x7fc823826000] Weighted P-Frames: Y:1.6% UV:0.5%
    [libx264 @ 0x7fc823826000] ref P L0: 66.8% 17.2% 11.7%  4.3%  0.1%
    [libx264 @ 0x7fc823826000] ref B L0: 91.0%  7.4%  1.7%
    [libx264 @ 0x7fc823826000] ref B L1: 96.0%  4.0%
    [libx264 @ 0x7fc823826000] kb/s:129.79

    ffprobe output :

    ffprobe output.mp4
    ffprobe version 2.3.3 Copyright (c) 2007-2014 the FFmpeg developers
     built on Feb 25 2015 23:01:46 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
     libavutil      52. 92.100 / 52. 92.100
     libavcodec     55. 69.100 / 55. 69.100
     libavformat    55. 48.100 / 55. 48.100
     libavdevice    55. 13.102 / 55. 13.102
     libavfilter     4. 11.100 /  4. 11.100
     libavresample   1.  3.  0 /  1.  3.  0
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 19.100 /  0. 19.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf55.48.100
     Duration: 00:06:18.38, start: 0.010227, bitrate: 141 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 322x240 [SAR 1:1 DAR 161:120], 129 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 2 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    digitaltsai:videos jtsai$
  • How to adjust mpeg 2 ts start time with ffmpeg ?

    29 juin 2015, par Maxim Kornienko

    I’m writing simple HLS (Http Live Streaming) java server to live cast (really live, not on demand) screenshow + voice. I constantly get chunks of image frames and audio samples as input to my service and produce mpeg 2 ts files + m3u8 playlist web page as output. The workflow is the following :

    1. Collect (buffer) source video frames and audio for certain period of time
    2. Convert series of video frames to h.264 encoded video file
    3. Convert audio samples to mp3 audio file
    4. Merge them to .ts file with ffmpeg command

      ffmpeg -i audio.mp3 -i video.mp4 -f mpegts -c:a copy -c:v copy -vprofile main -level:v 4.0 -vbsf h264_mp4toannexb -flags -global_header segment.ts
    5. Publish several .ts files on m3u8 playlist.

    The problem is resulting playlist interrupts after first segment is played. VLC logs following error :

    freetype error: Breaking unbreakable line
    ts error: libdvbpsi (PSI decoder): TS discontinuity (received 0, expected 4) for PID 17
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 4096
    core error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms)
    core error: ES_OUT_RESET_PCR called
    core error: Could not convert timestamp 185529572000
    ts error: libdvbpsi (PSI decoder): TS discontinuity (received 0, expected 4) for PID 17
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
    ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 4096
    core error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 8653 ms ignored)
    core error: Could not get display date for timestamp 0
    core error: Could not convert timestamp 185538017000
    core error: Could not convert timestamp 185538267000
    core error: Could not convert timestamp 185539295977
    ...

    I guess the reason is that start time of segments do not belong to one stream, but it’s impossible to concat and resegment (with ffmepg -f segment) whole stream once new chunk is added. Tried adding #EXT-X-DISCONTINUITY tag to playlist as suggested here but it didn’t help. When I ffprobe them I get :

    Input #0, mpegts, from '26.ts':
    Duration: 00:00:10.02, start: 1.876978, bitrate: 105 kb/s
    Program 1
    Metadata:
     service_name    : Service01
     service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 640x640, 4 fps, 4 tbr, 90k tbn, 8 tbc
    Stream #0:1[0x101]: Audio: mp3 ([3][0][0][0] / 0x0003), 48000 Hz, mono, s16p, 64 kb/s  

    Where start value in line Duration: 00:00:10.02, start: 1.876978, bitrate: 105 kb/s is more or less equal for all segments.
    When I check segments from available proven-to-work playlists (like http://vevoplaylist-live.hls.adaptive.level3.net/vevo/ch1/appleman.m3u8) they all have diffrenet start values for each segment, for example :

    Input #0, mpegts, from 'segm150518140104572-424570.ts':
    Duration: 00:00:06.17, start: 65884.808689, bitrate: 479 kb/s
    Program 257
    Stream #0:0[0x20]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 30 fps, 29.97 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x21]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 115 kb/s
    Stream #0:2[0x22]: Data: timed_id3 (ID3  / 0x20334449)

    and the next after it

    Input #0, mpegts, from 'segm150518140104572-424571.ts':
    Duration: 00:00:06.22, start: 65890.814689, bitrate: 468 kb/s
    Program 257
    Stream #0:0[0x20]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 30 fps, 29.97 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x21]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 124 kb/s
    Stream #0:2[0x22]: Data: timed_id3 (ID3  / 0x20334449)

    differ in the way that start time of segm150518140104572-424571.ts is equal to start time + duration of segm150518140104572-424570.ts.

    How could this start value be adjusted with ffmpeg ? Or maybe my whole aproach is wrong ? Unfortunately I couldn’t find on the internet working example of live (not on demand) video service implemented with ffmepg.

  • Speedup matplotlib animation to video file

    9 juillet 2015, par gaggio

    On Raspbian (Raspberry Pi 2), the following minimal example stripped from my script correctly produces an mp4 file :

    import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib import animation

    def anim_lift(x, y):

       #set up the figure
       fig = plt.figure(figsize=(15, 9))

       def animate(i):
           # update plot
           pointplot.set_data(x[i], y[i])

           return  pointplot

       # First frame
       ax0 = plt.plot(x,y)
       pointplot, = ax0.plot(x[0], y[0], 'or')

       anim = animation.FuncAnimation(fig, animate, repeat = False,
                                      frames=range(1,len(x)),
                                      interval=200,
                                      blit=True, repeat_delay=1000)

       anim.save('out.mp4')
       plt.close(fig)

    # Number of frames
    nframes = 200

    # Generate data
    x = np.linspace(0, 100, num=nframes)
    y = np.random.random_sample(np.size(x))

    anim_lift(x, y)

    Now, the file is produced with good quality and pretty small file size, but it takes 15 minutes to produce a 170 frames movie, which is not acceptable for my application. i’m looking for a significant speedup, video file size increase is not a problem.

    I believe the bottleneck in the video production is in the temporary saving of the frames in png format. During processing I can see the png files apprearing in my working directory, with the CPU load at 25% only.

    Please suggest a solution, that might also be based on a different package rather than simply matplotlib.animation, like OpenCV (which is anyway already imported in my project) or moviepy.

    Versions in use :

    • python 2.7.3
    • matplotlib 1.1.1rc2
    • ffmpeg 0.8.17-6:0.8.17-1+rpi1