Recherche avancée

Médias (0)

Mot : - Tags -/médias

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (112)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (14564)

  • Avoid using the term "file" and prefer "url" in some docs and comments

    5 décembre 2016, par Michael Niedermayer
    Avoid using the term "file" and prefer "url" in some docs and comments
    

    This should make it less ambigous that these are URLs

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] doc/ffmpeg.texi
    • [DH] doc/ffplay.texi
    • [DH] doc/ffprobe.texi
    • [DH] ffmpeg_opt.c
  • ffmpeg configure always returns "not found" when using sysroot and cross-prefix options - how to use them correctly ?

    5 août 2014, par user2212461

    I try to build ffmpeg with a cross-compiler. When setting the configure flags I am getting the following errors :

    WARNING: Compiler does not indicate floating-point ABI, guessing soft.
    build_it.sh: 29: build_it.sh: --sysroot=/home/android/android-ndk-r9/platforms/
       android-9/arch-arm/: not found
    build_it.sh: 32: build_it.sh.sh: --cross-prefix=/home/android/android-ndk-r9/
       toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-and
       roideabi-: not found

    The error message "not found" sounds like the paths dont exist but they are all correct and existing. How can I resolve this error ?

    build_it.sh :

    NDK=/home/android/android-ndk-r9
    SYSROOT=$NDK/platforms/android-9/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86
    CPU=arm
    PREFIX=test
    ADDI_CFLAGS="-marm"
    platform="android-9"

    ./configure \
       --disable-asm \
       --enable-shared \
       --target-os=linux \
       --arch=arm \
       --enable-cross-compile \
       --disable-static \
       --sysroot=$SYSROOT \
       --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
       --extra-ldflags="$ADDI_LDFLAGS"
       --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
       --prefix=$PREFIX \

    ##configure fails here
    ...
  • Using PyAV to encode mono audio to file, params match docs, but still causes Errno 22

    20 février 2023, par andrew8088

    While trying to use PyAV to encode live mono audio from a microphone to a compressed audio stream (using mp2 or flac as encoder), the program kept raising an exception ValueError: [Errno 22] Invalid argument.

    &#xA;

    To remove the live microphone source as a cause of the problem, and to make the problematic code easier for others to run/test, I have removed the mic source and now just generate a pure tone as a sequence of input buffers.

    &#xA;

    All attempts to figure out the missing or mismatched or incorrect argument have just resulted in seeing documentation and examples that are the same as my code.

    &#xA;

    I would like to know from someone who has used PyAV successfully for mono audio what the correct method and parameters are for encoding mono frames into the mono stream.

    &#xA;

    The package used is av 10.0.0 installed with&#xA;pip3 install av --no-binary av&#xA;so it uses my package-manager provided ffmpeg library, which is version 4.2.7.

    &#xA;

    The problematic python code is :

    &#xA;

    #!/usr/bin/env python3&#xA;# -*- coding: utf-8 -*-&#xA;"""&#xA;Recreating an error 22 when encoding sound with PyAV.&#xA;&#xA;Created on Sun Feb 19 08:10:29 2023&#xA;@author: andrewm&#xA;"""&#xA;import typing&#xA;import sys&#xA;import math&#xA;import fractions&#xA;&#xA;import av&#xA;from av import AudioFrame&#xA;&#xA;""" Ensure some PyAudio constants are still defined without changing &#xA;    the PyAudio recording callback function and without depending &#xA;    on PyAudio simply for reproducing the PyAV bug [Errno 22] thrown in &#xA;    File "av/filter/context.pyx", line 89, in av.filter.context.FilterContext.push&#xA;"""&#xA;class PA_Stub():&#xA;    paContinue = True&#xA;    paComplete= False&#xA;&#xA;pyaudio = PA_Stub()&#xA;&#xA;&#xA;"""Generate pure tone at given frequency with amplitude 0...1.0 at &#xA;   sampling frewuency fs and beginning at phase offset &#x27;phase&#x27;.&#xA;   Returns the new phase after the sinusoid has cycled over the &#xA;   sampling window length.&#xA;"""&#xA;def generate_tone(&#xA;        freq:int, phase:float, amp:float, fs, samp_fmt, buffer:bytearray&#xA;) -> float:&#xA;    assert samp_fmt == "s16", "Only s16 supported atm"&#xA;    samp_size_bytes = 2&#xA;    n_samples = int(len(buffer)/samp_size_bytes)&#xA;    window = [int(0) for i in range(n_samples)]&#xA;    theta = phase&#xA;    phase_inc = 2*math.pi * freq / fs&#xA;    for i in range(n_samples):&#xA;        v = amp * math.sin(theta)&#xA;        theta &#x2B;= phase_inc&#xA;        s = int((2**15-1)*v)&#xA;        window[i] = s&#xA;    for sample_i in range(len(window)):&#xA;        byte_i = sample_i * samp_size_bytes&#xA;        enc = window[sample_i].to_bytes(&#xA;                2, byteorder=sys.byteorder, signed=True&#xA;        )&#xA;        buffer[byte_i] = enc[0]&#xA;        buffer[byte_i&#x2B;1] = enc[1]&#xA;    return theta&#xA;&#xA;&#xA;channels = 1&#xA;fs = 44100  # Record at 44100 samples per second&#xA;fft_size_samps = 256&#xA;chunk_samps = fft_size_samps * 10  # Record in chunks that are multiples of fft windows.&#xA;&#xA;# print(f"fft_size_samps={fft_size_samps}\nchunk_samps={chunk_samps}")&#xA;&#xA;seconds = 3.0&#xA;out_filename = "testoutput.wav"&#xA;&#xA;# Store data in chunks for 3 seconds&#xA;sample_limit = int(fs * seconds)&#xA;sample_len = 0&#xA;frames = []  # Initialize array to store frames&#xA;&#xA;ffmpeg_codec_name = &#x27;mp2&#x27;  # flac, mp3, or libvorbis make same error.&#xA;&#xA;sample_size_bytes = 2&#xA;buffer = bytearray(int(chunk_samps*sample_size_bytes))&#xA;chunkperiod = chunk_samps / fs&#xA;total_chunks = int(math.ceil(seconds / chunkperiod))&#xA;phase = 0.0&#xA;&#xA;### uncomment if you want to see the synthetic data being used as a mic input.&#xA;# with open("test.raw","wb") as raw_out:&#xA;#     for ci in range(total_chunks):&#xA;#         phase = generate_tone(2600, phase, 0.8, fs, "s16", buffer)&#xA;#         raw_out.write(buffer)&#xA;# print("finished gen test")&#xA;# sys.exit(0)&#xA;# #---- &#xA;&#xA;# Using mp2 or mkv as the container format gets the same error.&#xA;with av.open(out_filename&#x2B;&#x27;.mp2&#x27;, "w", format="mp2") as output_con:&#xA;    output_con.metadata["title"] = "My title"&#xA;    output_con.metadata["key"] = "value"&#xA;    channel_layout = "mono"&#xA;    sample_fmt = "s16p"&#xA;&#xA;    ostream = output_con.add_stream(ffmpeg_codec_name, fs, layout=channel_layout)&#xA;    assert ostream is not None, "No stream!"&#xA;    cctx = ostream.codec_context&#xA;    cctx.sample_rate = fs&#xA;    cctx.time_base = fractions.Fraction(numerator=1,denominator=fs)&#xA;    cctx.format = sample_fmt&#xA;    cctx.channels = channels&#xA;    cctx.layout = channel_layout&#xA;    print(cctx, f"layout#{cctx.channel_layout}")&#xA;    &#xA;    # Define PyAudio-style callback for recording plus PyAV transcoding.&#xA;    def rec_callback(in_data, frame_count, time_info, status):&#xA;        global sample_len&#xA;        global ostream&#xA;        frames.append(in_data)&#xA;        nsamples = int(len(in_data) / (channels*sample_size_bytes))&#xA;        &#xA;        frame = AudioFrame(format=sample_fmt, layout=channel_layout, samples=nsamples)&#xA;        frame.sample_rate = fs&#xA;        frame.time_base = fractions.Fraction(numerator=1,denominator=fs)&#xA;        frame.pts = sample_len&#xA;        frame.planes[0].update(in_data)&#xA;        print(frame, len(in_data))&#xA;        &#xA;        for out_packet in ostream.encode(frame):&#xA;            output_con.mux(out_packet)&#xA;        for out_packet in ostream.encode(None):&#xA;            output_con.mux(out_packet)&#xA;        &#xA;        sample_len &#x2B;= nsamples&#xA;        retflag = pyaudio.paContinue if sample_lencode>

    &#xA;

    If you uncomment the RAW output part you will find the generated data can be imported as PCM s16 Mono 44100Hz into Audacity and plays the expected tone, so the generated audio data does not seem to be the problem.

    &#xA;

    The normal program console output up until the exception is :

    &#xA;

    mp2 at 0x7f8e38202cf0> layout#4&#xA;Beginning&#xA; 5120&#xA;. 5120&#xA;

    &#xA;

    The stack trace is :

    &#xA;

    Traceback (most recent call last):&#xA;&#xA;  File "Dev/multichan_recording/av_encode.py", line 147, in <module>&#xA;    ret_data, ret_flag = rec_callback(buffer, ci, {}, 1)&#xA;&#xA;  File "Dev/multichan_recording/av_encode.py", line 121, in rec_callback&#xA;    for out_packet in ostream.encode(frame):&#xA;&#xA;  File "av/stream.pyx", line 153, in av.stream.Stream.encode&#xA;&#xA;  File "av/codec/context.pyx", line 484, in av.codec.context.CodecContext.encode&#xA;&#xA;  File "av/audio/codeccontext.pyx", line 42, in av.audio.codeccontext.AudioCodecContext._prepare_frames_for_encode&#xA;&#xA;  File "av/audio/resampler.pyx", line 101, in av.audio.resampler.AudioResampler.resample&#xA;&#xA;  File "av/filter/graph.pyx", line 211, in av.filter.graph.Graph.push&#xA;&#xA;  File "av/filter/context.pyx", line 89, in av.filter.context.FilterContext.push&#xA;&#xA;  File "av/error.pyx", line 336, in av.error.err_check&#xA;&#xA;ValueError: [Errno 22] Invalid argument&#xA;&#xA;</module>

    &#xA;

    edit : It's interesting that the error happens on the 2nd AudioFrame, as apparently the first one was encoded okay, because they are given the same attribute values aside from the Presentation Time Stamp (pts), but leaving this out and letting PyAV/ffmpeg generate the PTS by itself does not fix the error, so an incorrect PTS does not seem the cause.

    &#xA;

    After a brief glance in av/filter/context.pyx the exception must come from a bad return value from res = lib.av_buffersrc_write_frame(self.ptr, frame.ptr)
    &#xA;Trying to dig into av_buffersrc_write_frame from the ffmpeg source it is not clear what could be causing this error. The only obvious one is a mismatch between channel layouts, but my code is setting the layout the same in the Stream and the Frame. That problem had been found by an old question pyav - cannot save stream as mono and their answer (that one parameter required is undocumented) is the only reason the code now has the layout='mono' argument when making the stream.

    &#xA;

    The program output shows layout #4 is being used, and from https://github.com/FFmpeg/FFmpeg/blob/release/4.2/libavutil/channel_layout.h you can see this is the value for symbol AV_CH_FRONT_CENTER which is the only channel in the MONO layout.

    &#xA;

    The mismatch is surely some other object property or an undocumented parameter requirement.

    &#xA;

    How do you encode mono audio to a compressed stream with PyAV ?

    &#xA;