Recherche avancée

Médias (91)

Autres articles (60)

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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Possibilité de déploiement en ferme

    12 avril 2011, par

    MediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
    Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)

Sur d’autres sites (11701)

  • Laravel ffmpeg failed to execute command

    4 septembre 2022, par John smith

    I'm using protonemedia/laravel-ffmpeg package everything works fine on localhost but on the live server, there is an error message shown.

    


    ProtoneMedia\ LaravelFFMpeg\ Exporters\ EncodingException

ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' '/www/wwwroot/hamza/storage/app/upload/videos/uofH50IWXt3Doqacxkd2tATboUT5gLfVGaAWyvsS.mp4' '-map' '0' '-vcodec' 'libx264' '-b:v' '1000k' '-sc_threshold' '0' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/www/wwwroot/hamza/storage/app/streamable_videos/21_0_1000_%05d.ts' '-master_pl_name' 'temporary_segment_playlist_0.m3u8' '-acodec' 'aac' '-b:a' '128k' '/www/wwwroot/hamza/storage/app/streamable_videos/21_0_1000.m3u8': Error Output: ffmpeg version 3.4.11 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --disable-encoder=libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Unrecognized option 'master_pl_name'. Error splitting the argument list: Option not found


    


    I'm using a job to do conversation

    


    ConvertVideoForStreaming.php Job :

    


    <?php

namespace App\Jobs;
set_time_limit(60000);

use FFMpeg;
use Carbon\Carbon;
use App\Models\Video;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class ConvertVideoForStreaming implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $video;

    public function __construct(Video $video)
    {
        $this->video = $video;
    }

    public function handle()
    {
        // create some video formats...
        $lowBitrateFormat  = (new X264)->setKiloBitrate(500);
        $highBitrateFormat = (new X264)->setKiloBitrate(3000);

        // open the uploaded video from the right disk...
        FFMpeg::fromDisk($this->video->disk)
            ->open($this->video->path)

            // call the 'exportForHLS' method and specify the disk to which we want to export...
            ->exportForHLS()
            ->withRotatingEncryptionKey(function ($filename, $contents) {
                Storage::disk('streamable_keys')->put($filename, $contents);
            })
            // we'll add different formats so the stream will play smoothly
            // with all kinds of internet connections...
            ->addFormat($lowBitrateFormat)
            ->addFormat($highBitrateFormat)

            // call the 'save' method with a filename...
            ->toDisk('streamable_videos')
            ->save($this->video->id . '.m3u8');

        // update the database so we know the convertion is done!
        $this->video->update([
            'converted_for_streaming_at' => Carbon::now(),
        ]);
    }
}


    


    I'm storing the key at custom disk "streamable_keys", and converted videos should be stored in "streamable_videos".

    


    the streamable keys are generated and saved to a directory without any issues, but streamable videos are not saved to the directory.

    


    after some tracks I found that the problem happens in this line of code :

    


            ->save($this->video->id . '.m3u8');


    


    all the lines before that line work perfectly.

    


    any ideas on how to fix that ?

    


    Full error screenshot

    


    ConvertVideoForStreaming.php

    


  • Conversion failed. 2 frames left in the queue on closing ffmpeg

    28 août 2020, par AlexZheda

    My simplified ffmpeg command (the longer one has over 300 files) is the following.

    



    ffmpeg -i "v1.mp4" -i "v2.mp4" -i "v3.mp4"
    -filter_complex "[0:v:0][1:v:0][2:v:0]concat=n=3:v=1:a=0,fps=fps=30[cv1]; 
        [0:a:0][1:a:0][2:a:0]concat=n=3:v=0:a=1,asetpts=N/SR/TB[ca1]; 
        [cv1]setpts=0.25*PTS[v4]; 
        [ca1]atempo=4,asetpts=N/SR/TB[a4]" 
    -c:v h264_nvenc -map "[v4]" -map "[a4]" x4_output_0.mp4


    



    The video encoding is working but then breaks and the output file seems to be truncated. The output files are nearly of the size as they should be but they can't be read.

    



    Video encoding failed\r\n
[aac @ 00000248a7856840] Qavg: 325.600\r\n
[aac @ 00000248a7856840] 2 frames left in the queue on closing\r\n
[aac @ 00000248a78595c0] Qavg: 236.279\r\n[aac @ 00000248a78595c0] 
2 frames left in the queue on closing\r\n
[aac @ 00000248a7855140] Qavg: 2729.299\r\n
[aac @ 00000248a7855140] 2 frames left in the queue on closing\r\n
[aac @ 00000248a785bec0] Qavg: 1158.664\r\n
[aac @ 00000248a785bec0] 2 frames left in the queue on closing\r\n
Conversion failed!\r\n")


    



      

    1. Does the error have anything to do with the audio part of .mp4 since aac @ ... ?
    2. 


    3. What does the Qavg mean in the error message ?
    4. 


    5. What is the difference in the video stream between the codec_time_base and the time_base (see the differences in the video attributes frequencies below) ?
    6. 


    



    Below are the frequencies of the video attributes for all videos that have more than 1 distinct value. It's of the form [(value, frequency), (value, frequency),...].

    



    codec_time_base --- [('1/60', 384), ('1001/60000', 7), ('50/2997', 1)]
has_b_frames --- [(0, 336), (2, 56)]
level --- [(31, 336), (30, 56)]
r_frame_rate --- [('30/1', 384), ('30000/1001', 7), ('2997/100', 1)]
avg_frame_rate --- [('30/1', 384), ('30000/1001', 7), ('2997/100', 1)]
time_base --- [('1/30', 383), ('1/30000', 7), ('1/2997', 1), ('1/15360', 1)]


    



    The same for the audio attributes in all those video files.

    



    codec_time_base --- [('1/48000', 386), ('1/44100', 6)]
sample_rate --- [('48000', 386), ('44100', 6)]
time_base --- [('1/48000', 386), ('1/44100', 6)]


    



      

    1. Is it possible that something is not right with some of the video files here that causes the breakdown of the encoding ?
    2. 


    


  • local.ERROR : ffmpeg failed to execute command

    20 août 2024, par AMNA IQBAL

    I am trying to draw points on a video.

    


    The Video is 12 seconds long and for one second there are 17 data points which needs to be plotted on the video of one frame (1 second).
    
It works for 6 seconds but not for 12 seconds.

    


    Why it's not working for longer videos ? Is there any limitations of commands in ffmpeg ?

    


    public function overlayCoordinates(Request $request)
{
Log::info('Received request to overlay coordinates on video.');

    set_time_limit(600); // 600 seconds = 10 minutes
    try {

        $request->validate([
            'video' => 'required|file|mimes:mp4,avi,mkv,webm|max:102400', // Video max size 100MB
            'coordinates' => 'required|file|mimes:txt|max:5120', // Coordinates text file max size 5MB
        ]);

        $videoFile = $request->file('video');
        $coordinatesFile = $request->file('coordinates');

        $videoFilePath = $videoFile->getRealPath();
        $videoFileName = $videoFile->getClientOriginalName();

        // Move the video file to the desired location if needed
        $storedVideoPath = $videoFile->storeAs('public/videos', $videoFileName);

        // Open the video file using Laravel FFmpeg
        $media = FFMpeg::fromDisk('public')->open('videos/' . $videoFileName);
        $duration = $media->getDurationInSeconds();

        Log::info('Duration: ' . $duration);

        $coordinatesJson = file_get_contents($coordinatesFile->getPathname());
        $coordinatesArray = json_decode($coordinatesJson, true);

        $frameRate = 30; // Assuming a frame rate of 30 fps
        $visibilityDuration = 0.5; // Set duration to 0.5 second

        for ($currentTime = 0; $currentTime < 7; $currentTime++) {
            $filterString = ""; // Reset filter string for each frame
            $frameIndex = intval($currentTime * $frameRate); // Convert current time to an index

            if (isset($coordinatesArray['graphics'][$frameIndex])) {
                // Loop through the first 5 keypoints (or fewer if not available)
                $keypoints = $coordinatesArray['graphics'][$frameIndex]['kpts'];
                for ($i = 0; $i < min(12, count($keypoints)); $i++) {
                    $keypoint = $keypoints[$i];

                    $x = $keypoint['p'][0] * 1920; // Scale x coordinate to video width
                    $y = $keypoint['p'][1] * 1080; // Scale y coordinate to video height

                    $startTime = $frameIndex / $frameRate; // Calculate start time
                    $endTime = $startTime + $visibilityDuration; // Set end time for 0.5 second duration

                    // Add drawbox filter for the current keypoint
                    $filterString .= "drawbox=x={$x}:y={$y}:w=10:h=10:color=red@0.5:t=fill:enable='between(t,{$startTime},{$endTime})',";
                }
                   Log::info("Processing frame index: {$frameIndex}, Drawing first 5 keypoints.");
        }

            $filterString = rtrim($filterString, ',');
            
            // Apply the filter for the current frame
            if (!empty($filterString)) {
                $media->addFilter(function ($filters) use ($filterString) {
                    $filters->custom($filterString);
                });
            }
        }

        $filename = uniqid() . '_overlayed.mp4';
        $destinationPath = 'videos/' . $filename;

        $format = new \FFMpeg\Format\Video\X264('aac');
        $format->setKiloBitrate(5000) // Increase bitrate for better quality
               ->setAdditionalParameters(['-profile:v', 'high', '-preset', 'veryslow', '-crf', '18']) // High profile, very slow preset, and CRF of 18 for better quality
               ->setAudioCodec('aac')
               ->setAudioKiloBitrate(192); // Higher audio bitrate
        

        // Export the video in one pass to a specific disk and directory
        $media->export()
              ->toDisk('public')
              ->inFormat($format)
              ->save($destinationPath);

        return response()->json([
            'message' => 'Video processed successfully with overlays.',
            'path' => Storage::url($destinationPath)
        ]);
    } catch (\Exception $e) {
        Log::error('Overlay process failed: ' . $e->getMessage());
        return response()->json(['error' => 'Overlay process failed. Please check logs for details.'], 500);
    }
}