Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (78)

  • L’agrémenter visuellement

    10 avril 2011

    MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
    Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté.

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (7292)

  • Bad file descriptor decoding mp3 to pipe with ffmpeg

    1er février 2017, par Pete Bleackley

    Can any FFMpeg gurus help me with the following ?

    I’m trying to convert a podcast to PCM and downsample it to 16KHz mono before feeding it to a speech recognition system for transcription. The command line

    ffmpeg -i http://media.blubrry.com/conlangery/content.blubrry.com/conlangery/Conlangery01.mp3 -f s16le -ac 1 -ar 16000 pipe:0

    fails with

    av_interleaved_write_frame() : Bad file descriptor

    What is the problem here and how do I fix it ?

    EDIT

    Full error message is

    ffmpeg version N-83189-gd5d474aea5-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 5.4.1 (Debian 5.4.1-4) 20161202
     configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
     libavutil      55. 44.100 / 55. 44.100
     libavcodec     57. 75.100 / 57. 75.100
     libavformat    57. 62.100 / 57. 62.100
     libavdevice    57.  2.100 / 57.  2.100
     libavfilter     6. 69.100 /  6. 69.100
     libswscale      4.  3.101 /  4.  3.101
     libswresample   2.  4.100 /  2.  4.100
     libpostproc    54.  2.100 / 54.  2.100
    Input #0, mp3, from 'http://media.blubrry.com/conlangery/content.blubrry.com/conlangery/Conlangery01.mp3':
     Metadata:
       track           : 1
       album           : Conlangery Podcast
       title           : Conlangery 01
       artist          : George Corley
       date            : 2011
     Duration: 00:44:58.08, start: 0.025057, bitrate: 128 kb/s
       Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
       Metadata:
         encoder         : LAME3.98r
    Output #0, s16le, to 'pipe:0':
     Metadata:
       track           : 1
       album           : Conlangery Podcast
       title           : Conlangery 01
       artist          : George Corley
       date            : 2011
       encoder         : Lavf57.62.100
       Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
       Metadata:
         encoder         : Lavc57.75.100 pcm_s16le
    Stream mapping:
     Stream #0:0 -> #0:0 (mp3 (native) -> pcm_s16le (native))
    Press [q] to stop, [?] for help
    av_interleaved_write_frame(): Bad file descriptor
    Error writing trailer of pipe:0: Bad file descriptorsize=       1kB time=00:00:00.02 bitrate= 256.0kbits/s speed=95.2x    
    video:0kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
    Conversion failed!
    Traceback (most recent call last):
     File "./PodcastTranscriber.py", line 206, in <module>
       PodcastTranscriber('http://conlangery.com/feed/',upload)()        
     File "./PodcastTranscriber.py", line 101, in __call__
       self.process(item)
     File "./PodcastTranscriber.py", line 136, in process
       (audio,errors)=mp3.run(stdout=subprocess.PIPE)
     File "/usr/local/lib/python2.7/site-packages/ffmpy.py", line 105, in run
       raise FFRuntimeError(self.cmd, self.process.returncode, out[0], out[1])
    ffmpy.FFRuntimeError: `ffmpeg -i http://media.blubrry.com/conlangery/content.blubrry.com/conlangery/Conlangery01.mp3 -f s16le -ac 1 -ar 16000 pipe:0` exited with status 1
    </module>

    The invoking code is

    def process(self,item):
       """Downloads the audio and transcribes it"""
       audio_url=None
       print item['title']
       for link in item.links:
           if link['rel']=='enclosure':
               audio_url=link['href']
       if audio_url is not None:
           pubDate=to_date(item.published_parsed)
           if self.lastUploadDate is None or pubDate>self.lastUploadDate:
               self.lastUploadDate=pubDate
           mp3=ffmpy.FFmpeg(inputs={audio_url:None},
                            outputs={'pipe:0':['-f','s16le','-ac','1','-ar','16000']})
           (audio,errors)=mp3.run(stdout=subprocess.PIPE)
           sphinx=subprocess.Popen(['java','-jar','transcriber.jar'],
                                   stdin=audio,
                                   stdout=subprocess.PIPE)
           wiki=threading.Thread(target=self.callback,args=(item,sphinx.stdout))
           wiki.start()
           #mp3.start()
           #mp3.join()
           sphinx.stdin.close()
           wiki.join()
           sphinx.wait()
  • Extract video thumbnail using PHP without ffmpeg

    18 mai 2018, par SharpAffair

    The question is similar to : Is there any way to create a video thumbnail through PHP without ffmpeg ?
    However, that thread is 6-year old and technologies have evolved since then.

    Any way to extract a thumbnail from uploaded MP4 file using PHP ?

    Ffmpeg is great, but unfortunately unsupported on shared hosting accounts, requiring a dedicated server. And it’s a kinda overkill to use ffmpeg’s power just to generate a video preview picture.

    Any other simple solution ?

  • FFMPEG : RTSP re-stream dies randomly

    14 mai 2018, par stevendesu

    I have a security camera streaming RTSP, and I wish to re-stream this to an RTMP ingest server. For now I’m using my laptop as an ffmpeg proxy, but eventually I’ll use a raspberry pi or something similar (cheap/small)

    Here’s the command I’m using (pretty simple) :

    ffmpeg -i rtsp://@10.0.0.16:554/1/h264major -c:v libx264 -c:a none -f flv rtmp://output/camera_stream

    This works but after a minute or two the stream dies. Here’s the output :

    ffmpeg version N-90057-g7c82e0f Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
     configuration: --prefix=/home/sbarnett/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/sbarnett/ffmpeg_build/include --extra-ldflags=-L/home/sbarnett/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/sbarnett/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libspeex --enable-nonfree
     libavutil      56.  7.101 / 56.  7.101
     libavcodec     58. 11.101 / 58. 11.101
     libavformat    58.  9.100 / 58.  9.100
     libavdevice    58.  1.100 / 58.  1.100
     libavfilter     7. 12.100 /  7. 12.100
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
    Input #0, rtsp, from 'rtsp://@10.0.0.16:554/1/h264major':
     Metadata:
       title           : h264major
       comment         : h264major
     Duration: N/A, start: 0.360000, bitrate: N/A
       Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 720x480, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [libx264 @ 0x38843c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x38843c0] profile High, level 3.0
    [libx264 @ 0x38843c0] 264 - core 155 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=6 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, flv, to 'rtmp://output/camera_stream':
     Metadata:
       title           : h264major
       comment         : h264major
       encoder         : Lavf58.9.100
       Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuvj420p(pc), 720x480, q=-1--1, 25 fps, 1k tbn, 25 tbc
       Metadata:
         encoder         : Lavc58.11.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Past duration 0.999992 too large
       Last message repeated 29 times
    [rtsp @ 0x3847600] max delay reached. need to consume packet
    [rtsp @ 0x3847600] RTP: missed 48 packets
    Past duration 0.999992 too large
       Last message repeated 4 times
    frame=   44 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A dup=0 drop=5 speed=   0x    
    frame=   57 fps= 54 q=28.0 size=      43kB time=00:00:00.16 bitrate=2186.4kbits/s dup=0 drop=5 speed=0.153x    
    ... (lots of similar messages) ...  
    frame= 1163 fps= 26 q=28.0 size=    1341kB time=00:00:44.84 bitrate= 245.0kbits/s dup=0 drop=5 speed=0.99x    
    frame= 1177 fps= 26 q=28.0 size=    1353kB time=00:00:45.40 bitrate= 244.2kbits/s dup=0 drop=5 speed=0.99x    
    [rtsp @ 0x3847600] max delay reached. need to consume packet
    [rtsp @ 0x3847600] RTP: missed 2 packets
    frame= 1190 fps= 26 q=28.0 size=    1370kB time=00:00:45.92 bitrate= 244.4kbits/s dup=0 drop=5 speed=0.99x    
    [h264 @ 0x38c08c0] Increasing reorder buffer to 1
    frame= 1201 fps= 26 q=28.0 size=    1381kB time=00:00:46.36 bitrate= 244.0kbits/s dup=0 drop=5 speed=0.989x    
    frame= 1214 fps= 26 q=28.0 size=    1393kB time=00:00:46.88 bitrate= 243.4kbits/s dup=0 drop=5 speed=0.989x    
    ... (lots of similar messages) ...    
    frame= 1761 fps= 25 q=28.0 size=    2030kB time=00:01:08.80 bitrate= 241.7kbits/s dup=0 drop=5 speed=0.993x    
    frame= 1774 fps= 25 q=28.0 size=    2041kB time=00:01:09.32 bitrate= 241.2kbits/s dup=0 drop=5 speed=0.993x    
    [flv @ 0x3884900] Failed to update header with correct duration.
    [flv @ 0x3884900] Failed to update header with correct filesize.
    frame= 1782 fps= 25 q=-1.0 Lsize=    2127kB time=00:01:11.64 bitrate= 243.2kbits/s dup=0 drop=5 speed=1.02x    
    video:2092kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.679417%
    [libx264 @ 0x38843c0] frame I:8     Avg QP:16.89  size: 42446
    [libx264 @ 0x38843c0] frame P:1672  Avg QP:19.54  size:  1065
    [libx264 @ 0x38843c0] frame B:102   Avg QP:23.00  size:   205
    [libx264 @ 0x38843c0] consecutive B-frames: 92.4%  0.0%  0.0%  7.6%
    [libx264 @ 0x38843c0] mb I  I16..4: 12.9% 36.2% 50.9%
    [libx264 @ 0x38843c0] mb P  I16..4:  0.2%  0.2%  0.0%  P16..4: 16.7%  0.7%  1.0%  0.0%  0.0%    skip:81.1%
    [libx264 @ 0x38843c0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 11.7%  0.1%  0.0%  direct: 1.5%  skip:86.5%  L0:62.2% L1:35.3% BI: 2.5%
    [libx264 @ 0x38843c0] 8x8 transform intra:40.8% inter:47.4%
    [libx264 @ 0x38843c0] coded y,uvDC,uvAC intra: 46.5% 53.0% 17.2% inter: 3.9% 8.7% 0.0%
    [libx264 @ 0x38843c0] i16 v,h,dc,p: 21% 56%  8% 15%
    [libx264 @ 0x38843c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 33% 31%  1%  2%  3%  2%  2%  3%
    [libx264 @ 0x38843c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 39%  9%  3%  3%  4%  5%  3%  8%
    [libx264 @ 0x38843c0] i8c dc,h,v,p: 43% 33% 21%  3%
    [libx264 @ 0x38843c0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x38843c0] ref P L0: 88.0%  1.4%  6.6%  4.0%
    [libx264 @ 0x38843c0] ref B L0: 99.4%  0.5%  0.1%
    [libx264 @ 0x38843c0] ref B L1: 99.4%  0.6%
    [libx264 @ 0x38843c0] kb/s:238.73

    The camera is pretty cheap (from China) so it’s likely I’m getting bad data from it or it’s cutting out for a few seconds at a time. Ideally I would need ffmpeg to handle this well (ignore bad data, wait as long as necessary for good data to resume encoding)

    Using ffplay to check out the RTSP stream, I get output like the following :

    $> ffplay -i rtsp://@10.0.0.16:554/1/h264major
    ffplay version N-90057-g7c82e0f Copyright (c) 2003-2018 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
     configuration: --prefix=/home/sbarnett/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/sbarnett/ffmpeg_build/include --extra-ldflags=-L/home/sbarnett/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/sbarnett/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libspeex --enable-nonfree
     libavutil      56.  7.101 / 56.  7.101
     libavcodec     58. 11.101 / 58. 11.101
     libavformat    58.  9.100 / 58.  9.100
     libavdevice    58.  1.100 / 58.  1.100
     libavfilter     7. 12.100 /  7. 12.100
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
    Input #0, rtsp, from 'rtsp://@10.0.0.16:554/1/h264major':0B f=0/0
     Metadata:
       title           : h264major
       comment         : h264major
     Duration: N/A, start: 0.320000, bitrate: N/A
       Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 720x480, 25 fps, 25 tbr, 90k tbn, 50 tbc
    [swscaler @ 0x7f6bbc093180] deprecated pixel format used, make sure you did set range correctly
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 2 packets
    [h264 @ 0x7f6bc0041080] error while decoding MB 44 28, bytestream -37
    [h264 @ 0x7f6bc0041080] concealing 95 DC, 95 AC, 95 MV errors in I frame
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 1 packets
    [h264 @ 0x7f6bc0041080] error while decoding MB 43 29, bytestream -49
    [h264 @ 0x7f6bc0041080] concealing 51 DC, 51 AC, 51 MV errors in I frame
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 2 packets
    [h264 @ 0x7f6bc0041080] Increasing reorder buffer to 1
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 3 packets
    [h264 @ 0x7f6bc02c3600] error while decoding MB 27 29, bytestream -24
    [h264 @ 0x7f6bc02c3600] concealing 67 DC, 67 AC, 67 MV errors in I frame
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 2 packets
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 42 packets
    [rtsp @ 0x7f6bc0000940] max delay reached. need to consume packet
    [rtsp @ 0x7f6bc0000940] RTP: missed 2 packets

    Then eventually the video just freezes. The first time it froze after around 5 minutes, but I wasn’t able to say definitively if it froze the instant 44 packets were dropped or if it froze randomly later. So the second time I stared intently.... for 21 minutes. Then I got bored of it not freezing, turned to pet my cat, and when I looked back 15 seconds later it was frozen. I think it only breaks when no one is watching it.

    What I can say definitively is :

    • While running normally, M-V hovers around 0 (anywhere between -0.01 and +0.01)
    • Once frozen, M-V begins to count down into negative numbers without stopping - although at a rate slower than -1 per second
    • While running normally, aq is 0KB and vq is a positive number (I think it was 30KB or so ?)
    • Once frozen, vq is also 0KB

    It’s a really cheap camera with a crummy power supply that goes out if you breathe on it, so it’s likely the camera is going temporarily offline during this time — but I’d like ffmpeg to wait out a timeout and resume streaming when it sees the camera again.