Recherche avancée

Médias (91)

Autres articles (13)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

Sur d’autres sites (2960)

  • Checking Video Quality using WP Code, Forminator and FFmpeg is not working [closed]

    3 septembre 2024, par guiliannkamga Guilian90

    I have a WordPress website where users should be able to upload videos. The quality of the videos should be checked upon upload, meaning the videos must have a 16:9 aspect ratio and be in HD. If a video does not meet these conditions, the upload should not be allowed, and the user should be informed of the reason.

    


    I am using the WordPress plugin Forminator for the video upload form and WP Code with a code snippet that contains PHP code. FFmpeg version 4.4.2 is installed on my server.

    


    ffmpeg version

    


    Form to upload a Video

    


    My provider is DreamHost, and I can connect to the server via Terminal on my MacBook and run ffmpeg commands without any issues.

    


    I added the form to a page and when I upload invalid videos, unfortunately, I do not receive any error messages, which should be happening according to my code, and I do not know why.

    


    Uploading the Video

    


    Success Message after uploading the Video

    


    Can someone help me ?

    


    add_filter('forminator_custom_form_submit_before_set_fields', 'forminator_video_validation', 10, 3);

function forminator_video_validation($entry, $form_id, $field_data) {
    foreach ($field_data as $field) {
        if ($field['name'] === 'upload-1') { // 'upload-1' is the ID of the Datei-Upload-Field in Forminator
            $file = $field['value']['file']['file_path'];

            // check if the file exists
            if (!file_exists($file)) {
                wp_die('File does not exist');
            }

            // ffmpeg command to check video size and resolution
            $command = "ffmpeg -i " . escapeshellarg($file) . " 2>&1";
            $output = shell_exec($command);

            // extract resoltion from the ffmpeg output
            if (preg_match('/Stream #0:0.*Video:.* (\d+)x(\d+)/', $output, $matches)) {
                $width = (int) $matches[1];
                $height = (int) $matches[2];
                $aspect_ratio = $width / $height;
                $allowed_aspect_ratio = 16 / 9;
                $min_width = 1280;
                $min_height = 720;

                // check if the video fullfills the criterias
                if ($width < $min_width || $height < $min_height || round($aspect_ratio, 2) != round($allowed_aspect_ratio, 2)) {
                    wp_die('The video must be at least in HD (1280x720) and must have the format 16:9. (Found: ' . $width . 'x' . $height . ')');
                }
            } else {
                // If the video could not be analysed
                wp_die('The Video could not be analysed');
            }
        }
    }
}


    


    PHP Code Snippet in WPCode

    


    WPCode Settings

    


  • Using lcov With FFmpeg/Libav

    21 novembre 2011, par Multimedia Mike — Programming, code coverage, ffmpeg, lcov, libav

    Last year, I delved into code coverage tools and their usage with FFmpeg. I learned about using GNU gcov, which is powerful but pretty raw about the details it provides to you. I wrote a script to help interpret its output and later found another script called gcovr to do the same, only much better.

    I later found another tool called lcov which is absolutely amazing for understanding code coverage of your software. I’ve been meaning to use it to further FATE test coverage for the multimedia projects.



    Click for larger image

    Basic Instructions
    Install the lcov tool, of course. In Ubuntu, 'apt-get install lcov' will do the trick.

    Build the project with code coverage support, i.e.,

    ./configure —enable-gpl —samples=/path/to/fate/samples \
     —extra-cflags="-fprofile-arcs -ftest-coverage" \
     —extra-ldflags="-fprofile-arcs -ftest-coverage"
    make
    

    Clear the coverage data :

    lcov —directory . —zerocounters
    

    Run the software (in this case, the FATE test suite) :

    make fate
    

    Let lcov work its magic :

    lcov —directory . —capture —output-file coverage.info
    mkdir html-output
    genhtml -o html-output coverage.info
    

    At this point, you can aim your web browser at html-output/index.html to learn everything you could possibly want to know about code coverage of the test suite. You can sort various columns in order to see which modules have the least code coverage. You can drill into individual source files and see highlighted markup demonstrating which lines have been executed.

    As you can see from the screenshot above, FFmpeg / Libav are not anywhere close to full coverage. But lcov provides an exquisite roadmap.

  • How can I create a write stream for res for a child_process.spawn method as it says cp.spawn().pipe(res) is not a method

    11 juin 2022, par niishaaant
    const express = require('express');
const router = express.Router();
const ytdl = require('ytdl-core');
const cp = require('child_process');
const ffmpeg = require('ffmpeg-static');

router.get('/', async (req, res) => {
    const { v, f, q } = req.query;
    if (!ytdl.validateID(v) && !ytdl.validateURL(v)) {
        return res
            .status(400)
            .json({ success: false, error: 'No valid YouTube Id!' });
    }
    try {
        let info = await ytdl.getInfo(v);

        //set format and title
        // const title = info.videoDetails.title;
        // res.setHeader('Content-disposition', contentDisposition(`${title}${f}`));

        //define audio and video stream seperately and download them
        const audio = ytdl(v, { quality: 'highestaudio' }).on(
            'progress',
            (_, downloaded, total) => {
                console.log({ downloaded, total });
            }
        );
        let format = ytdl.chooseFormat(info.formats, { quality: q });
        const video = ytdl(v, { format }).on('progress', (_, downloaded, total) => {
            console.log({ downloaded, total });
        });

        const ffmpegProcess = cp
            .spawn(
                ffmpeg,
                [
                    // Remove ffmpeg's console spamming
                    '-loglevel',
                    '8',
                    '-hide_banner',
                    // Redirect/Enable progress messages
                    '-progress',
                    'pipe:3',
                    // Set inputs
                    '-i',
                    'pipe:4',
                    '-i',
                    'pipe:5',
                    // Map audio & video from streams
                    '-map',
                    '0:a',
                    '-map',
                    '1:v',
                    // Keep encoding
                    '-c:v',
                    'copy',
                    // Define output file
                    `out.${f}`,
                ],
                {
                    windowsHide: true,
                    stdio: [
                        /* Standard: stdin, stdout, stderr */
                        'inherit',
                        'inherit',
                        'inherit',
                        /* Custom: pipe:3, pipe:4, pipe:5 */
                        'pipe',
                        'pipe',
                        'pipe',
                    ],
                }
            )
            .on('close', () => {
                console.log('done');
            });

        // Link streams
        // FFmpeg creates the transformer streams and we just have to insert / read data
        ffmpegProcess.stdio[3].on('data', (chunk) => {
            // Parse the param=value list returned by ffmpeg
            const lines = chunk.toString().trim().split('\n');
            const args = {};
            for (const l of lines) {
                const [key, value] = l.split('=');
                args[key.trim()] = value.trim();
            }
        });
        audio.pipe(ffmpegProcess.stdio[4]);
        video.pipe(ffmpegProcess.stdio[5]);
    } catch (error) {
        res.status(400);
        console.log('error ', error);
    }
});

module.exports = router;


    


    


    I am trying to create a youtube downloader app and this is the code for downloading a video using the ytdl and ffmpeg packages in an express route but i don't know how i can download the result (out.mp4) for the client. when I try to pipe it to res error occurs saying cp.spawn().pipe() is not a method.