Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (73)

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

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

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

  • Problem with FFmpeg breaking when streaming the entire screen and switching tabs

    2 octobre 2024, par Ibad Ahmad

    I'm working on a screen recording and streaming setup where the user records their entire screen and streams it to Twitch. The setup works fine initially, but when I switch tabs during recording, the stream breaks on the backend, and I get the following FFmpeg errors :

    


    FFmpeg STDERR: [matroska,webm @ 0x7f9dcb904580] EBML header parsing failed
[in#0 @ 0x7f9dcb904380] Error opening input: Invalid data found when processing input
Error opening input file -.
Error opening input files: Invalid data found when processing input


    


    My frontend code captures the screen and microphone and streams it via a WebSocket to the backend, where FFmpeg processes the stream. Below is my relevant frontend code :

    


    const startRecording = async () => {
    try {
        const screenStream = await navigator.mediaDevices.getDisplayMedia({
            preferCurrentTab: true,
            systemAudio: 'include',
            surfaceSwitching: 'include',
            monitorTypeSurfaces: 'include',
            video: {
                displaySurface: 'browser',
                height: 720,
                width: 1280,
                frameRate: { ideal: 24, max: 30 },
            },
        });

        screenStream.getVideoTracks()[0].onended = () => {
            console.log('Screen sharing ended. Stopping the recorder.');
            stopRecording();
        };

        const micStream = await navigator.mediaDevices.getUserMedia({
            audio: true,
        });

        const combinedStream = new MediaStream([
            ...screenStream.getVideoTracks(),
            ...micStream.getAudioTracks(),
        ]);

        const recorder = new MediaRecorder(combinedStream, {
            mimeType: 'video/webm; codecs=vp8,opus',
            videoBitsPerSecond: 3 * 1024 * 1024,
        });

        const timeslice = 1000;

        recorder.ondataavailable = async (event) => {
            if (socket?.current?.connected && event.data.size > 0) {
                console.log('Sending chunk data:', socket.current.id);
                socket?.current.send(event.data);
                recordedChunks.current.push(event.data);
            } else if (!socket?.current?.connected) {
                handleSocketDisconnection();
            }
        };

        mediaRecorder.current = recorder;
        recorder.start(timeslice);
        setIsRecording(true);
    } catch (error) {
        console.log('Error starting screen recording:', error);
        toast.error('Failed to start screen recording: ' + error);
    }
};

const stopRecording = () => {
    if (socket?.current && mediaRecorder) {
        mediaRecorder?.current?.stop();
        socket.current.close();
        setIsRecording(false);
        downloadRecordedVideo();
    }
};



    


    And here’s my backend code with FFmpeg settings for Twitch streaming :

    


    const inputSettings = [
    '-f', 'webm', '-i', '-', '-v', 'error', '-analyzeduration', '1000000', '-probesize', '5000000',
];

const twitchSettings = (twitch) => {
    return [
        '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency',
        '-g', '60', '-b:v', '2500k', '-maxrate', '3000k', '-bufsize', '8000k',
        '-r', '30', '-vf', 'tpad=stop_mode=clone:stop_duration=2',
        '-c:a', 'aac', '-ar', '44100', '-b:a', '96k',
        '-use_wallclock_as_timestamps', '1', '-async', '1',
        '-err_detect', 'ignore_err', '-reconnect', '1',
        '-reconnect_streamed', '1', '-reconnect_delay_max', '5',
        '-y', '-f', 'flv', twitch,
    ];
};



    


    Problem : When switching tabs during screen sharing, it seems like the frame rate drops or the stream gets interrupted, leading to FFmpeg errors like EBML header parsing failed and Invalid data found when processing input. I suspect this happens because the browser deprioritizes resources when the tab is not active, which might lead to corrupt chunks being sent to FFmpeg.

    


    Questions :

    


      

    1. Could switching tabs during screen capture be causing the issue by disrupting the frame rate or dropping frames ?
    2. 


    3. Is there a way to ensure FFmpeg doesn’t break due to these interruptions ?
    4. 


    5. Any suggestions on handling the stream more reliably when switching tabs or optimizing the FFmpeg setup for this scenario ?
    6. 


    


    I tried adjusting the bitrate, frame rate, and buffer size but still experienced the same issue. I'm trying to figure out if the issue is related to how browsers handle screen capture when tab switching or something specific with FFmpeg handling the video stream.

    


    Any insights would be greatly appreciated.
Thanks in advance !

    


  • avformat/dvdvideodec : discard duplicate or partial AC3 samples

    7 octobre 2024, par Marth64
    avformat/dvdvideodec : discard duplicate or partial AC3 samples
    

    Some DVD muxers signal segments to start with duplicate audio samples
    when starting extraction from a chapter marker or terminate seamless PGs
    on partial audio samples (causing corrupt AC3 frames). Clean up after
    these muxers by tracking frames with duplicate PTS and eliminating
    partial AC3 frames.

    This results in smoother chapter extraction and overall seeking experience,
    with linear PTS and AC3 delay within 32ms (1 frame) away from the video.

    The issue was not apparent until the flushing pattern was replaced with
    a full subdemux reset, as the flushing dropped the frames prematurely,
    along side others, as such they were never present to begin with.

    • [DH] libavformat/dvdvideodec.c
  • writing jpg images from ffmpeg pipe

    18 septembre 2024, par seandoucette

    Using php to read an rtsp stream from an ffmpeg command utilizing image2pipe, I'm finding the images are truncated in some manner and only display a partial image. My task is to write unique jpg filenames at 30fps. Below is the php code. I've simplified the filename structure in this example for clarity. The script performs as expected with no obvious errors writing out 30fps consistently. I can't figure out what extraneous or missing information in the content is causing the output images to appear corrupt.

    


    $cmd = "ffmpeg -rtsp_transport tcp -framerate 30 -i rtsp://".$camera_url." -f image2pipe pipe:1";

$fp = popen($cmd, 'r');

if (!$fp)
{
    die('Could not open ffmpeg process');
}

define('JPEG_START', "\xFF\xD8");
define('JPEG_END', "\xFF\xD9");

$buffer = '';
$jpeg = '';
$isReadingJpeg = false;

stream_set_blocking($fp, false); // Set non-blocking mode

while (!feof($fp))
{
    $chunk = fread($fp, 4096);

    if ($chunk === false)
    {
        usleep(100);
        continue;
    }

    $buffer .= $chunk;

    if (!$isReadingJpeg && ($startPos = strpos($buffer, JPEG_START)) !== false)
    {
        $isReadingJpeg = true;
        $jpeg = substr($buffer, $startPos);
        $buffer = substr($buffer, $startPos + 2);  // Move past the start marker
    }

    if ($isReadingJpeg && ($endPos = strpos($buffer, JPEG_END)) !== false)
    {
        $jpeg .= substr($buffer, 0, $endPos + 2);
        $buffer = substr($buffer, $endPos + 2);  // Move past the end marker

        file_put_contents(microtime(true),$jpeg);

        $isReadingJpeg = false;
        $jpeg = '';
    }

    if ($isReadingJpeg)
    {
        $jpeg .= $buffer;
        $buffer = '';
    }
}

pclose($fp);