Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (49)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (5723)

  • avformat/internal : Move ff_read_line_to_bprint_overwrite to avio_internal.h

    23 juillet 2021, par Andreas Rheinhardt
    avformat/internal : Move ff_read_line_to_bprint_overwrite to avio_internal.h
    

    It only uses an AVIOContext and an AVBPrint.

    When doing so, it turned out that several non-users of
    ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata()
    relied on libavformat/internal.h to include bprint.h or avstring.h
    for them. In order to avoid a repeat of this and in order to reduce
    unnecessary dependencies, a forward declaration of struct AVBPrint is
    used instead of including bprint.h.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

    • [DH] libavdevice/v4l2.c
    • [DH] libavformat/aadec.c
    • [DH] libavformat/argo_asf.c
    • [DH] libavformat/argo_cvg.c
    • [DH] libavformat/au.c
    • [DH] libavformat/avio_internal.h
    • [DH] libavformat/concatdec.c
    • [DH] libavformat/dashdec.c
    • [DH] libavformat/dashenc.c
    • [DH] libavformat/flacenc.c
    • [DH] libavformat/framecrcenc.c
    • [DH] libavformat/hlsenc.c
    • [DH] libavformat/internal.h
    • [DH] libavformat/librist.c
    • [DH] libavformat/mxfdec.c
    • [DH] libavformat/ttmlenc.c
    • [DH] libavformat/utils.c
  • How to use ffmpeg in flask server to convert between audio formats without writing files to disk ?

    14 avril 2020, par Athwulf

    I have successfully managed to use ffmpeg in python to convert the format of some audio files like this :

    &#xA;&#xA;

    command = "ffmpeg -i audio.wav -vn -acodec pcm_s16le output.wav"&#xA;subprocess.call(command, shell=True)&#xA;

    &#xA;&#xA;

    However I want to do this in memory and avoid saving the input and output files to disk.

    &#xA;&#xA;

    I have found the follwing code to do such a thing (Passing python’s file like object to ffmpeg via subprocess) :

    &#xA;&#xA;

    command = [&#x27;ffmpeg&#x27;, &#x27;-y&#x27;, &#x27;-i&#x27;, &#x27;-&#x27;, &#x27;-f&#x27;, &#x27;wav&#x27;, &#x27;-&#x27;]&#xA;process = subprocess.Popen(command, stdin=subprocess.PIPE)&#xA;wav, errordata = process.communicate(file)&#xA;

    &#xA;&#xA;

    But I am struggeling to use this in my context.

    &#xA;&#xA;

    I am receiving the file on a server as part of a multipart/form-data request.

    &#xA;&#xA;

    @server.route("/api/getText", methods=["POST"])&#xA;def api():&#xA;    if "multipart/form-data" not in request.content_type:&#xA;        return Response("invalid content type: {}".format(request.content_type))&#xA;    # check file format&#xA;    file = request.files[&#x27;file&#x27;]&#xA;    if file:&#xA;        print(&#x27;**found file&#x27;, file.filename)&#xA;

    &#xA;&#xA;

    Now I have the file as a FileStorage Object (https://tedboy.github.io/flask/generated/generated/werkzeug.FileStorage.html). This object has a stream, which can be accessed by using the read method. So I thought I might be able to use this as input for ffmpeg like so :

    &#xA;&#xA;

    f = file.read()&#xA;command = [&#x27;ffmpeg&#x27;, &#x27;-y&#x27;, &#x27;-i&#x27;, &#x27;-&#x27;, &#x27;-f&#x27;, &#x27;wav&#x27;, &#x27;-&#x27;]&#xA;process = subprocess.Popen(command, stdin=subprocess.PIPE)&#xA;wav, errordata = process.communicate(f)&#xA;

    &#xA;&#xA;

    However this yields the the following error :

    &#xA;&#xA;

    AssertionError: Given audio file must be a filename string or a file-like object&#xA;

    &#xA;&#xA;

    I have also tried another approach which I found online, using io.BytesIO, to which I can't find the source anymore :

    &#xA;&#xA;

    memfile = io.BytesIO()  # create file-object&#xA;memfile.write(file.read())  # write in file-object&#xA;memfile.seek(0)  # move to beginning so it will read from beginning&#xA;

    &#xA;&#xA;

    And then trying this again :

    &#xA;&#xA;

    command = [&#x27;ffmpeg&#x27;, &#x27;-y&#x27;, &#x27;-i&#x27;, &#x27;-&#x27;, &#x27;-f&#x27;, &#x27;wav&#x27;, &#x27;-&#x27;]&#xA;process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)&#xA;wav, errordata = process.communicate(memfile)&#xA;

    &#xA;&#xA;

    This gets me the following error :

    &#xA;&#xA;

    TypeError: a bytes-like object is required, not &#x27;_io.BytesIO&#x27;&#xA;

    &#xA;&#xA;

    Does anyone have an idea of how to do this ?

    &#xA;&#xA;

    Update

    &#xA;&#xA;

    The first error message is actually not a error message thrown by ffmpeg. As v25 pointed out correctly in his answer the first approach also returns a bytes object and is also a valid solution.

    &#xA;&#xA;

    The error message got thrown by a library (speech_recognition) when trying to work with the modified file. In the unlikely case of someone coming across the same problem here the solution :

    &#xA;&#xA;

    The bytes objected returned by ffmpeg (variable wav) has to be turned into a file-like object as the error message implies. This can easily be done like this :

    &#xA;&#xA;

    memfileOutput = io.BytesIO(wav)

    &#xA;

  • Video encoder & segmenter for HLS VoD poor quality

    10 juillet 2017, par Murilo

    I am trying to encode and segment video for HLS on demand(VoD).
    I am using the following code for such :

    ffmpeg -i 20170706_174314.mp4 -c 24 \
           -vcodec libx264 -acodec aac -ac 1 -strict -2 -b:v 128k \
           -profile:v baseline -maxrate 400k -bufsize 1835k \
           -hls_time 10 -hls_playlist_type vod -vsync 1 \
           video_chunks/index1.m3u8 \
           -c 24 -vcodec libx264 -acodec aac -ac 1 -strict -2 -b:v 128k \
           -profile:v baseline -maxrate 700k -bufsize 1835k \
           -hls_time 10 -hls_playlist_type vod -vsync 1 \
           video_chunks/index2.m3u8

    I tried this other code also just for segmenting but had the same exactly problem :

    ffmpeg -i 20170706_174314.mp4 \
    -c:a libmp3lame -ar 48000 -ab 64k  -c:v libx264 -b:v 128k -flags \
    -global_header -map 0 -f segment \
    -segment_list video_chunks/test.m3u8 -segment_time 10 -segment_format mpegts \
    video_chunks/segment_%05d.ts

    Later on I create another playlist with bandwidth separators to call on the two other playlists generated with the code above.

    This code was working great on some videos but yesterday I recorded a video with my Samsung J7 Prime phone to test since the videos will be generated by phone and this video was poorly encoded. The quality sucks and some parts of the video turned Black&White.

    Another thing I noticed on this video is that the following message kept appearing in loop until the end of the encoding&segmenting process.

    Past duration X too large

    Where X is a decimal really close to

    0.675316

    The link to the video is below :

    Dropbox Link

    My FFmpeg version :

    ffmpeg --version
    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

    SO : Windows 10

    EDIT1 : Link to the output
    If you see the output it might be worth saying I am also seeing the message

    VBV underflow(Frame X, -Y bits)