Recherche avancée

Médias (91)

Autres articles (88)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

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

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

  • MPlayer not playing HTTP video stream for a specific type of content from the same source

    2 août 2017, par Joel

    Implementation overview

    Before I dive into the question, I need to establish the context from the start.

    I am currently implementing a cloud gaming solution utilising the following :

    • Nvidia Capture SDK
    • Nvidia Video Codec SDK
    • FFmpeg
    • MPlayer

    The Nvidia Capture SDK is used to produce a shim layer (via DXGI.dll), intercepting and capturing DirectX frames so that they can be passed to the Nvidia Video Codec SDK to be encoded into an h264 video format. All this is done within DXGI.dll.

    I then pass the encoded video to FFmpeg. FFmpeg acts as an HTTP server that broadcasts the video stream for MPlayer to play.

    Problem

    I am running an Unreal Engine 4 game called "Epic Survival Game Series". The Nvidia Capture SDK’s shim layer kicks off when the game starts, and FFmpeg launches the HTTP server to start streaming. However, when I start MPlayer to receive the stream, MPlayer stops at the following message, and nothing happens after that.

    libavformat version 57.72.101 (internal)
    Stream not seekable!
    H264-ES file format detected

    The thing is, when I play the same video using ffplay, it works without any issue. This is not the only quirk. When I launch a different Unreal Engine 4 game called "First Person Shooter Template", MPlayer can play that video as well. Also, if I modify the Survival Game to load directly into the game level by skipping the menu, MPlayer is also able to play the video.

    Using FFmpeg to write the video to a file instead of streaming it to a video also works, no matter the game or whether I loaded into the menu or game level.

    This is very strange and I do not have any idea why this is the case. Any ideas ?

    Edit : One strange quirk I forgot to mention is that MPlayer does manage to play the video in very rare occasions - maybe once every 10-20 tries or so.

    Implementation Details

    Additional details of how certain parts are implemented.

    (1) For the Nvidia Capture SDK, I use the provided DXIFRShim example that is provided in the SDK

    (2) for the Nvidia Video Codec SDK, I use the provided NvEncoder example that is provided in the SDK

    (3) The FFmpeg command I use is this :
    ffmpeg -i - -listen 1 -threads 1 -vcodec copy -preset ultrafast -an -tune zerolatency -f h264 http://address:port
    The encoded frames from Nvidia Video Codec SDK is piped to FFmpeg.

    (4) The MPlayer command I use is this :
    mplayer -quiet -vo gl -nosound -benchmark http://address:port

    Things I’ve tried

    I am suspecting MPlayer to be the cause, so I’ve only played around with MPlayer parameters.
    mplayer http://address:port

    mplayer -fps 30 -vo gl -nosound -benchmark http://address:port

    mplayer -fps 30 -screenw 720 -screenh 1280 -vo gl -nosound -benchmark http://address:port

    mplayer -fps 30 -vo directx -nosound -benchmark http://address:port

    mplayer -fps 30 -vo null -nosound -benchmark http://address:port

    None of these worked.

  • Transcode video with ffmpeg can't play by Win10 system player ?

    16 juin 2017, par wzjing

     I’m doing a video transcoder demo with ffmpeg lib and libx264 lib. I already can transcode video successully, but the output video can only play by some powerful player like VLC. I need it can be played by the Win10 system player and the Android system player. I hava found the reason may be encode AVCodecContext args. I try to copy those args frome decode AVCodecContext, the output can be played by Win10 defualt player, but the video became totally black.
     Here is my encode AVCodecContext args :

           encoder = avcodec_find_encoder(AV_CODEC_ID_H264);

           if (!encoder) {
               av_log(NULL, AV_LOG_FATAL, "Necessary encoder not found\n");
               return AVERROR_INVALIDDATA;
           }
           enc_ctx = avcodec_alloc_context3(encoder);
           enc_ctx->height = output_height;
           enc_ctx->width = output_width;
           enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
           enc_ctx->bit_rate = 1000000;

           /* take first format from list of supported formats */
           if (encoder->pix_fmts)
               enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
           else
               enc_ctx->pix_fmt = dec_ctx->pix_fmt;

           enc_ctx->time_base = av_inv_q(dec_ctx->framerate);
           enc_ctx->gop_size = 12;
           av_opt_set(enc_ctx->priv_data, "preset", "slow", 0);
           av_opt_set(enc_ctx->priv_data, "tune", "zerolatency", 0);

           enc_ctx->profile = FF_PROFILE_H264_HIGH;
           enc_ctx->codec_type = AVMEDIA_TYPE_VIDEO;      

           enc_ctx->codec_tag = 0;