Recherche avancée

Médias (91)

Autres articles (86)

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

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (10804)

  • A ffmpeg comman canwork in cmd but not in Python using subprocess.call() or os.system()

    6 juin 2018, par Starrysky

    I wanna transfer a .mp3 to .wav. This is my command :
    ffmpeg -i a.mp3 -ar 16000 -ac 1 -acodec pcm_s16le a.wav

    It worked well in cmd

    C:\Users\starrysky\Documents\GitHub\bing_pic\html>ffmpeg -i a.mp3 -ar 16000 -ac 1 -acodec pcm_s16le a.wav
    ffmpeg version N-86482-gbc40674 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 7.1.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --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-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --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-zlib
     libavutil      55. 66.100 / 55. 66.100
     libavcodec     57. 99.100 / 57. 99.100
     libavformat    57. 73.100 / 57. 73.100
     libavdevice    57.  7.100 / 57.  7.100
     libavfilter     6. 92.100 /  6. 92.100
     libswscale      4.  7.101 /  4.  7.101
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
    Input #0, mp3, from 'a.mp3':
     Metadata:
       encoder         : Lavf54.6.100
     Duration: 00:00:01.87, start: 0.000000, bitrate: 8 kb/s
       Stream #0:0: Audio: mp3, 8000 Hz, mono, s16p, 8 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (mp3 (native) -> pcm_s16le (native))
    Press [q] to stop, [?] for help
    Output #0, wav, to 'a.wav':
     Metadata:
       ISFT            : Lavf57.73.100
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
       Metadata:
         encoder         : Lavc57.99.100 pcm_s16le
    size=      59kB time=00:00:01.87 bitrate= 256.3kbits/s speed= 187x
    video:0kB audio:58kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.130208%

    but when I moved it into my python program, something strange happened.

    >>> C:\Users\starrysky\Documents\GitHub\bing_pic\html\
    'ffmpeg' �����ڲ����ⲿ���Ҳ���ǿ����еij���
    �����������
    1 Command 'ffmpeg -i a.mp3 -ar 16000 -ac 1 -acodec pcm_s16le a.wav' returned non-zero exit status 1.
    文件错误啊,亲
    [WinError 2] 系统找不到指定的文件。: 'a.wav'

    This is part of my python code :

    @bot.register(wife, RECORDING)
    def translate_sound(msg):
       msg.get_file(save_path='a.mp3')
       path = os.path.abspath('.')+'\\'
       print(path)
       try:
           subprocess.check_call('ffmpeg -i a.mp3 -ar 16000 -ac 1 -acodec pcm_s16le a.wav', shell=True)
           # ''
       except Exception as e:
           print(1, e)
       wav_to_text('a.wav')
       try:
           os.remove('a.wav')
       except Exception as e:
           print(e)

    # 调用百度语音识别API
    def get_token():
       URL = 'http://openapi.baidu.com/oauth/2.0/token'
       _params = urllib.parse.urlencode({'grant_type': b'client_credentials',
                                         'client_id': b''
                                         'client_secret': b''})
       _res = urllib.request.Request(URL, _params.encode())
       _response = urllib.request.urlopen(_res)
       _data = _response.read()
       _data = json.loads(_data)
       return _data['access_token']


    def wav_to_text(wav_file):
       try:
           wav_file = open(wav_file, 'rb')
       except IOError:
           print('文件错误啊,亲')
           return
       wav_file = wave.open(wav_file)
       n_frames = wav_file.getnframes()
       print('n_frames ', n_frames)
       frame_rate = wav_file.getframerate()
       print("frame_rate ", frame_rate)
       if n_frames == 1 or frame_rate not in (8000, 16000):
           print('不符合格式')
           return
       audio = wav_file.readframes(n_frames)
       seconds = n_frames/frame_rate+1
       minute = int(seconds/60 + 1)
       for i in range(0, minute):
           sub_audio = audio[i*60*frame_rate:(i+1)*60*frame_rate]
           base_data = base64.b64encode(sub_audio)
           data = {"format": "wav",
                   "token": get_token(),
                   "len": len(sub_audio),
                   "rate": frame_rate,
                   "speech": base_data.decode(),
                   "cuid": "B8-AC-6F-2D-7A-94",
                   "channel": 1}
           data = json.dumps(data)
           res = urllib.request.Request('http://vop.baidu.com/server_api',
                                 data.encode(),
                                 {'content-type': 'application/json'})
           response = urllib.request.urlopen(res)
           res_data = json.loads(response.read())
           try:
               print(res_data['result'][0])
           except Exception as e:
               print(e)

    What happened ?

  • FFMpeg is dropping video track when clipping an mpg video

    16 juin 2017, par M. Grishaber

    I am extracting a clip from an mpg video using the following command.
    ffmpeg.exe -i 271b.mpg -ss 00:00:05.000 -t 00:00:03.200 -c copy out_271b.mpg

    I am using the copy parameter to avoid reencoding the clip.
    The resulting mpg file only has the audio track, no video.
    The following is the FFMpeg screen dump.

    C:\ffmpeg-20170615\bin>ffmpeg.exe -i 271b.mpg -ss 00:00:05.000 -t 00:00:03.200 -c copy out_271b.mpg
       ffmpeg version N-86482-gbc40674 Copyright (c) 2000-2017 the FFmpeg developers
         built with gcc 7.1.0 (GCC)
         configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --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-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --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-zlib
         libavutil      55. 66.100 / 55. 66.100
         libavcodec     57. 99.100 / 57. 99.100
         libavformat    57. 73.100 / 57. 73.100
         libavdevice    57.  7.100 / 57.  7.100
         libavfilter     6. 92.100 /  6. 92.100
         libswscale      4.  7.101 /  4.  7.101
         libswresample   2.  8.100 /  2.  8.100
         libpostproc    54.  6.100 / 54.  6.100
       Input #0, mpeg, from '271b.mpg':
         Duration: 00:01:11.44, start: 0.460000, bitrate: 2154 kb/s
           Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, progressive), 640x480 [SAR 1:1 DAR 4:3], 2000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
           Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, mono, s16p, 128 kb/s
       [mpeg @ 0000000000666aa0] VBV buffer size not set, using default size of 130KB
       If you want the mpeg file to be compliant to some specification
       Like DVD, VCD or others, make sure you set the correct buffer size
       Output #0, mpeg, to 'out_271b.mpg':
         Metadata:
           encoder         : Lavf57.73.100
           Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt470bg, progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 2000 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
           Stream #0:1: Audio: mp2, 44100 Hz, mono, s16p, 128 kb/s
       Stream mapping:
         Stream #0:0 -> #0:0 (copy)
         Stream #0:1 -> #0:1 (copy)
       Press [q] to stop, [?] for help
       frame=   74 fps=0.0 q=-1.0 Lsize=     786kB time=00:00:03.17 bitrate=2027.2kbits/s speed= 198x
       video:730kB audio:50kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.843343%

    Thanks

    Addition : I tried to open the generated clip file with ffplay and got the following results. Note that ffplay was able to open and play the original mpg file.

    ffplay.exe out_271b.mpg
    ffplay version N-86482-gbc40674 Copyright (c) 2003-2017 the FFmpeg developers
     built with gcc 7.1.0 (GCC)
     configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --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-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --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-zlib
     libavutil      55. 66.100 / 55. 66.100
     libavcodec     57. 99.100 / 57. 99.100
     libavformat    57. 73.100 / 57. 73.100
     libavdevice    57.  7.100 / 57.  7.100
     libavfilter     6. 92.100 /  6. 92.100
     libswscale      4.  7.101 /  4.  7.101
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
    [mpeg @ 00000000023cde80] probed stream 2 failedB sq=    0B f=0/0
    [mpeg @ 00000000023cde80] start time for stream 0 is not set in estimate_timings_from_pts
    [mpeg @ 00000000023cde80] Could not find codec parameters for stream 2 (Video: none, none): unknown codec
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, mpeg, from 'out_271bb.mpg':
     Duration: 00:00:03.22, start: 0.500000, bitrate: 2068 kb/s
       Stream #0:0[0x1bf]: Data: dvd_nav_packet  0KB sq=    0B f=0/0
       Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, mono, s16p, 128 kb/s
       Stream #0:2[0x1e0]: Video: none, none, 25 fps, 25 tbr, 90k tbn
    SDL_OpenAudio (1 channels, 44100 Hz): DirectSoundCreate: No audio device found
    No more combinations to try, audio open failed
    No codec could be found with id 0
    Failed to open file 'out_271b.mpg' or configure filtergraph
  • ffmpeg concatenate videos keeping data stream

    27 juin 2017, par jabal

    I have 2 video segments where each of them has an AMF data stream embedded.

    ffprobe segment_360p.mp4
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'segment_360p.mp4':
     Metadata:
       **major_brand     : f4v**
       minor_version   : 0
       compatible_brands: isommp42m4v
       creation_time   : 2017-06-26 19:16:08
     Duration: 00:01:14.23, start: 0.000000, bitrate: 1055 kb/s
       Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 933 kb/s, 29.76 fps, 29.97 tbr, 90k tbn, 59.94 tbc (defa
    lt)
       Metadata:
         creation_time   : 2017-06-26 19:16:08
         handler_name    : WowzaStreamingEngine
         encoder         : WowzaStreamingEngine
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 116 kb/s (default)
       Metadata:
         creation_time   : 2017-06-26 19:16:08
         handler_name    : WowzaStreamingEngine
       Stream #0:2(eng): Data: none (amf0 / 0x30666D61), 0 kb/s (default)
       Metadata:
         creation_time   : 2017-06-26 19:16:08
         handler_name    : WowzaStreamingEngine

    I am using ffmpeg to concatenate two such videos with the -f concat filter (ffmpeg -f concat -i mylist.txt -c copy output.mp4) Unfortunately in the output stream this data stream is completely lost :

    ffprobe output.mp4
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
     Metadata:
       **major_brand     : isom**
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.16.102
     Duration: 00:03:38.93, start: 0.000000, bitrate: 1032 kb/s
       Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 903 kb/s, 29.50 fps, 29.97 tbr, 90k tbn, 59.94 tbc (defau
    lt)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 120 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    While looking at the output, I noticed that the "major_brand" changed from f4v to isom, not sure if that is related or not.

    How can I preserve the data stream while concatenating videos ?