Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (80)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

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

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

Sur d’autres sites (10110)

  • avformat/iamf : fix setting channel layout for Scalable layers

    17 juin, par James Almer
    avformat/iamf : fix setting channel layout for Scalable layers
    

    The way streams are coded in an IAMF struct follows a scalable model where the
    channel layouts for each layer may not match the channel order our API can
    represent in a Native order layout.

    For example, an audio element may have six coded streams in the form of two
    stereo streams, followed by two mono streams, and then by another two stereo
    streams, for a total of 10 channels, and define for them four scalable layers
    with loudspeaker_layout values "Stereo", "5.1ch", "5.1.2ch", and "5.1.4ch".
    The first layer references the first stream, and each following layer will
    reference all previous streams plus extra ones.
    In this case, the "5.1ch" layer will reference four streams (the first two
    stereo and the two mono) to encompass six channels, which does not match out
    native layout 5.1(side) given that FC and LFE come after FL+FR but before
    SL+SR, and here, they are at the end.

    For this reason, we need to build Custom order layouts that properly represent
    what we're exporting.


    Before :

    Stream group #0:0[0x12c] : IAMF Audio Element :
    Layer 0 : stereo
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Layer 1 : 5.1(side)
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Stream #0:1[0x1] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:2[0x2] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:3[0x3] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Layer 2 : 5.1.2
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Stream #0:1[0x1] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:2[0x2] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:3[0x3] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:4[0x4] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3 : 5.1.4
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Stream #0:1[0x1] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:2[0x2] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:3[0x3] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:4[0x4] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:5[0x5] : Audio : opus, 48000 Hz, stereo, fltp (dependent)


    AFter :

    Stream group #0:0[0x12c] : IAMF Audio Element :
    Layer 0 : stereo
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Layer 1 : 6 channels (FL+FR+SL+SR+FC+LFE)
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Stream #0:1[0x1] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:2[0x2] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:3[0x3] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Layer 2 : 8 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR)
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Stream #0:1[0x1] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:2[0x2] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:3[0x3] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:4[0x4] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3 : 10 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR+TBL+TBR)
    Stream #0:0[0x0] : Audio : opus, 48000 Hz, stereo, fltp (default)
    Stream #0:1[0x1] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:2[0x2] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:3[0x3] : Audio : opus, 48000 Hz, mono, fltp (dependent)
    Stream #0:4[0x4] : Audio : opus, 48000 Hz, stereo, fltp (dependent)
    Stream #0:5[0x5] : Audio : opus, 48000 Hz, stereo, fltp (dependent)

    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] libavformat/iamf_parse.c
    • [DH] libavformat/iamf_writer.c
    • [DH] libavformat/iamfdec.c
    • [DH] tests/ref/fate/iamf-5_1-copy
    • [DH] tests/ref/fate/iamf-5_1-demux
    • [DH] tests/ref/fate/iamf-5_1_4
    • [DH] tests/ref/fate/iamf-7_1_4
    • [DH] tests/ref/fate/iamf-9_1_6
    • [DH] tests/ref/fate/mov-mp4-iamf-5_1_4
    • [DH] tests/ref/fate/mov-mp4-iamf-7_1_4-video-first
    • [DH] tests/ref/fate/mov-mp4-iamf-7_1_4-video-last
  • How to fix av_interleaved_write_frame() broken pipe error in php

    31 mars, par Adekunle Adeyeye

    I have an issue using ffmpeg to stream audio and parse to google cloud speech to text in PHP.

    &#xA;

    It returns this output.&#xA;I have tried delaying some part of the script, that did not solve it.&#xA;I have also checked for similar questions. however, they are mostly in python and none of the solutions actually work for this.

    &#xA;

      built with gcc 8 (GCC)&#xA;  cpudetect&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mp3, from &#x27;https://npr-ice.streamguys1.com/live.mp3&#x27;:&#xA;  Metadata:&#xA;    icy-br          : 96&#xA;    icy-description : NPR Program Stream&#xA;    icy-genre       : News and Talk&#xA;    icy-name        : NPR Program Stream&#xA;    icy-pub         : 0&#xA;    StreamTitle     :&#xA;  Duration: N/A, start: 0.000000, bitrate: 96 kb/s&#xA;    Stream #0:0: Audio: mp3, 32000 Hz, stereo, fltp, 96 kb/s&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))&#xA;Press [q] to stop, [?] for help&#xA;Output #0, s16le, to &#x27;pipe:&#x27;:&#xA;  Metadata:&#xA;    icy-br          : 96&#xA;    icy-description : NPR Program Stream&#xA;    icy-genre       : News and Talk&#xA;    icy-name        : NPR Program Stream&#xA;    icy-pub         : 0&#xA;    StreamTitle     :&#xA;    encoder         : Lavf58.29.100&#xA;    Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.54.100 pcm_s16le&#xA;**av_interleaved_write_frame(): Broken pipe** 256.0kbits/s speed=1.02x&#xA;**Error writing trailer of pipe:: Broken pipe**&#xA;size=      54kB time=00:00:01.76 bitrate= 250.8kbits/s speed=0.465x&#xA;video:0kB audio:55kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;Conversion failed!&#xA;

    &#xA;

    this is my PHP code

    &#xA;

    require_once &#x27;vendor/autoload.php&#x27;;&#xA;    &#xA;    $projectId = "xxx-45512";&#xA;    putenv(&#x27;GOOGLE_APPLICATION_CREDENTIALS=&#x27; . __DIR__ . &#x27;/xxx-45512-be3eb805f1d7.json&#x27;);&#xA;    &#xA;    // Database connection&#xA;    $pdo = new PDO(&#x27;mysql:host=localhost;dbname=&#x27;, &#x27;&#x27;, &#x27;&#x27;);&#xA;    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);&#xA;    &#xA;    $url = "https://npr-ice.streamguys1.com/live.mp3";&#xA;    &#xA;    $ffmpegCmd = "ffmpeg -re -i $url -acodec pcm_s16le -ac 1 -ar 16000 -f s16le -";&#xA;    &#xA;    $fp = popen($ffmpegCmd, "r");&#xA;    if (!$fp) {&#xA;        die("Failed to open FFmpeg stream.");&#xA;    }&#xA;    sleep(5);&#xA;&#xA;    try {&#xA;        $client = new SpeechClient([&#x27;transport&#x27; => &#x27;grpc&#x27;, &#x27;credentials&#x27; => json_decode(file_get_contents(getenv(&#x27;GOOGLE_APPLICATION_CREDENTIALS&#x27;)), true)]);&#xA;    } catch (Exception $e) {&#xA;        echo &#x27;Error: &#x27; . $e->getMessage(); &#xA;        exit;&#xA;    }&#xA;    &#xA;    $recognitionConfig = new RecognitionConfig([&#xA;        &#x27;auto_decoding_config&#x27; => new AutoDetectDecodingConfig(),&#xA;        &#x27;language_codes&#x27; => [&#x27;en-US&#x27;],&#xA;        &#x27;model&#x27; => &#x27;long&#x27;,&#xA;    ]);&#xA;    &#xA;    $streamingConfig = new StreamingRecognitionConfig([&#xA;        &#x27;config&#x27; => $recognitionConfig,&#xA;    ]);&#xA;    &#xA;    $configRequest = new StreamingRecognizeRequest([&#xA;        &#x27;recognizer&#x27; => "projects/$projectId/locations/global/recognizers/_",&#xA;        &#x27;streaming_config&#x27; => $streamingConfig,&#xA;    ]);&#xA;    &#xA;    &#xA;    function streamAudio($fp)&#xA;    {&#xA;        while (!feof($fp)) {&#xA;            yield fread($fp, 4096);&#xA;        }&#xA;    }&#xA;    &#xA;    $responses = $client->streamingRecognize([&#xA;    &#x27;requests&#x27; => (function () use ($configRequest, $fp) {&#xA;            yield $configRequest; // Send initial config&#xA;            foreach (streamAudio($fp) as $audioChunk) {&#xA;                yield new StreamingRecognizeRequest([&#x27;audio&#x27; => $audioChunk]);&#xA;            }&#xA;        })()]&#xA;    );&#xA;    &#xA;    // $responses = $speechClient->streamingRecognize();&#xA;    // $responses->writeAll([$request,]);&#xA;    &#xA;    foreach ($responses as $response) {&#xA;        foreach ($response->getResults() as $result) {&#xA;            $transcript = $result->getAlternatives()[0]->getTranscript();&#xA;            // echo "Transcript: $transcript\n";&#xA;    &#xA;            // Insert into the database&#xA;            $stmt = $pdo->prepare("INSERT INTO transcriptions (transcript) VALUES (:transcript)");&#xA;            $stmt->execute([&#x27;transcript&#x27; => $transcript]);&#xA;        }&#xA;    }&#xA;    &#xA;    &#xA;    pclose($fp);&#xA;    $client->close();&#xA;

    &#xA;

    I'm not sure what the issue is at this time.

    &#xA;

    UPDATE

    &#xA;

    I've done some more debugging and i have gotten the error to clear and to stream actually starts.&#xA;However, I expect the audio to transcribe and update my database but instead I get this error when i close the stream

    &#xA;

    error after closing stream

    &#xA;

    this is my updated code

    &#xA;

        $handle = popen($ffmpegCommand, "r");&#xA;&#xA;    try {&#xA;        $client = new SpeechClient([&#x27;transport&#x27; => &#x27;grpc&#x27;, &#x27;credentials&#x27; => json_decode(file_get_contents(getenv(&#x27;GOOGLE_APPLICATION_CREDENTIALS&#x27;)), true)]);&#xA;    } catch (Exception $e) {&#xA;        echo &#x27;Error: &#x27; . $e->getMessage(); &#xA;        exit;&#xA;    }&#xA;    &#xA;    try {&#xA;    $recognitionConfig = (new RecognitionConfig())&#xA;        ->setAutoDecodingConfig(new AutoDetectDecodingConfig())&#xA;        ->setLanguageCodes([&#x27;en-US&#x27;], [&#x27;en-UK&#x27;])&#xA;        ->setModel(&#x27;long&#x27;);&#xA;    } catch (Exception $e) {&#xA;        echo &#x27;Error: &#x27; . $e->getMessage(); &#xA;        exit;&#xA;    }&#xA;    &#xA;    try {&#xA;        $streamConfig = (new StreamingRecognitionConfig())&#xA;        ->setConfig($recognitionConfig);&#xA;    } catch (Exception $e) {&#xA;        echo &#x27;Error: &#x27; . $e->getMessage();&#xA;        exit;&#xA;    }&#xA;    try {&#xA;        $configRequest = (new StreamingRecognizeRequest())&#xA;        ->setRecognizer("projects/$projectId/locations/global/recognizers/_")&#xA;        ->setStreamingConfig($streamConfig);&#xA;    } catch (Exception $e) {&#xA;        echo &#x27;Error: &#x27; . $e->getMessage(); &#xA;        exit;&#xA;    }&#xA;    &#xA;    $stream = $client->streamingRecognize();&#xA;    $stream->write($configRequest);&#xA;    &#xA;    mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES (&#x27;bef&#x27;)");&#xA;    &#xA;    while (!feof($handle)) {&#xA;        $chunk = fread($handle, 25600);&#xA;        // printf(&#x27;chunk: &#x27; . $chunk);&#xA;        if ($chunk !== false) {&#xA;            try {&#xA;                $request = (new StreamingRecognizeRequest())&#xA;                        ->setAudio($chunk);&#xA;                    $stream->write($request);&#xA;            } catch (Exception $e) {&#xA;                printf(&#x27;Errorc: &#x27; . $e->getMessage());&#xA;            }&#xA;        }&#xA;    }&#xA;    &#xA;    &#xA;    $insr = json_encode($stream);&#xA;    mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES (&#x27;$insr&#x27;)");&#xA;    &#xA;    foreach ($stream->read() as $response) {&#xA;        mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES (&#x27;loop1&#x27;)");&#xA;        foreach ($response->getResults() as $result) {&#xA;            mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES (&#x27;loop2&#x27;)");&#xA;            foreach ($result->getAlternatives() as $alternative) {&#xA;                $trans = $alternative->getTranscript();&#xA;                mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES (&#x27;$trans&#x27;)");&#xA;            }&#xA;        }&#xA;    }&#xA;    &#xA;    pclose($handle);&#xA;    $stream->close();&#xA;    $client->close();```&#xA;

    &#xA;

  • avformat/iamf_writer : add support for expanded channel layouts

    10 décembre 2024, par James Almer
    avformat/iamf_writer : add support for expanded channel layouts
    

    Defined in Immersive Audio Model and Formats 1.1.0, sections 3.6.2 and 3.7.3

    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] libavformat/iamf_writer.c