Recherche avancée

Médias (91)

Autres articles (111)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

  • 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

Sur d’autres sites (7328)

  • Batch .SRT Rip Using FFMPEG

    12 mai 2020, par jaac

    I have this command using ffmpeg

    



    root@ubuntu-4cpu-8gb-sg-sin1:/home/jaac/torrents/rtorrent/dots# ffmpeg -i Title.NF.WEB-DL.DDP2.0.x264-Ao.mkv -map 0:7 indo16.srt


    



    That will rip 1 sub (Indonesia region)

    



    How to rip it in batch ? I have 17 files in dots folder

    



    Thanks

    


  • How to Convert 16:9 Video to 9:16 Ratio While Ensuring Speaker Presence in Frame ?

    28 avril 2024, par shreesha

    I am tried so many time to figure out the problem in detecting the face and also it's not so smooth enough to like other tools out there.

    


    So basically I am using python and Yolo in this project but I want the person who is talking and who the ROI (region of interest) is.

    


    Here is the code :

    


    from ultralytics import YOLO
from ultralytics.engine.results import Results
from moviepy.editor import VideoFileClip, concatenate_videoclips
from moviepy.video.fx.crop import crop

# Load the YOLOv8 model
model = YOLO("yolov8n.pt")

# Load the input video
clip = VideoFileClip("short_test.mp4")

tacked_clips = []

for frame_no, frame in enumerate(clip.iter_frames()):
    # Process the frame
    results: list[Results] = model(frame)

    # Get the bounding box of the main object
    if results[0].boxes:
        objects = results[0].boxes
        main_obj = max(
            objects, key=lambda x: x.conf
        )  # Assuming the first detected object is the main one

        x1, y1, x2, y2 = [int(val) for val in main_obj.xyxy[0].tolist()]

        # Calculate the crop region based on the object's position and the target aspect ratio
        w, h = clip.size
        new_w = int(h * 9 / 16)
        new_h = h

        x_center = x2 - x1
        y_center = y2 - y1

        # Adjust x_center and y_center if they would cause the crop region to exceed the bounds
        if x_center + (new_w / 2) > w:
            x_center -= x_center + (new_w / 2) - w
        elif x_center - (new_w / 2) < 0:
            x_center += abs(x_center - (new_w / 2))

        if y_center + (new_h / 2) > h:
            y_center -= y_center + (new_h / 2) - h
        elif y_center - (new_h / 2) < 0:
            y_center += abs(y_center - (new_h / 2))

        # Create a subclip for the current frame
        start_time = frame_no / clip.fps
        end_time = (frame_no + 1) / clip.fps
        subclip = clip.subclip(start_time, end_time)

        # Apply cropping using MoviePy
        cropped_clip = crop(
            subclip, x_center=x_center, y_center=y_center, width=new_w, height=new_h
        )

        tacked_clips.append(cropped_clip)

reframed_clip = concatenate_videoclips(tacked_clips, method="compose")
reframed_clip.write_videofile("output_video.mp4")


    


    So basically I want to fix the face detection with ROI detection where it can detect the face and make that face and the body on to the frame and making sure that the speaker who is speaking is brought to the frame

    


  • FFmpegFrameGrabber and FFmpegFrameRecorder Audio Issue

    20 août 2015, par Sheheryar Chagani

    I am compress an existing camera recorded video using FFmpegframerecorder and ffmpegFrameGrabber.

    The issue is that its audio is not occurring after compression.

    Please note that I am using googlecode.javacv along with javacpp and armeabi in lib folder.

    Below is the code which I have used.

    public void compressVideo(String filePath)

       FrameGrabber grabber = new FFmpegFrameGrabber(filePath);
       grabber.start();
       fileoutput = filePath.replace("trimmed", "compressed");
       // recorder.setAudioCodec(grabber.get);
       FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(fileoutput, 480,
               480, grabber.getAudioChannels());
       recorder.setFrameRate(grabber.getFrameRate());
       recorder.setSampleRate(grabber.getSampleRate());
       recorder.setSampleFormat(grabber.getSampleFormat());
       recorder.setFormat(grabber.getFormat());
       // recorder.setPixelFormat(grabber.getPixelFormat());

       recorder.start();
       Frame frame;
       int count = 0;
       while ((frame = grabber.grabFrame()) != null) {
           if (frame.image != null) {
               publishProgress(count);
               count++;
               IplImage rotateImage = rotate(frame.image, 90);
               IplImage cropImage = resizeImage(rotateImage, 480, 480, true);
               frame.image = cropImage;
               recorder.record(frame);
               if (rotateImage != null)
                   opencv_core.cvReleaseImage(rotateImage);
               if (cropImage != null)
                   opencv_core.cvReleaseImage(cropImage);
           } else {
               recorder.record(frame);
           }

       }
       recorder.stop();
       grabber.stop();
       recorder.release();
       grabber.release();
    }

    IplImage resizeImage(IplImage origImg, int newWidth, int newHeight,
           boolean keepAspectRatio) {

       IplImage outImg;
       int origWidth = 0;
       int origHeight = 0;
       if (origImg != null) {
           origWidth = origImg.width();
           origHeight = origImg.height();
       }
       if (newWidth <= 0 || newHeight <= 0 || origImg == null
               || origWidth <= 0 || origHeight <= 0) {
           // cerr << "ERROR: Bad desired image size of " << newWidth
           // << "x" << newHeight << " in resizeImage().\n";
           return null;
       }

       if (keepAspectRatio) {
           // Resize the image without changing its aspect ratio,
           // by cropping off the edges and enlarging the middle section.
           CvRect r;
           // input aspect ratio
           float origAspect = (origWidth / (float) origHeight);
           // output aspect ratio
           float newAspect = (newWidth / (float) newHeight);
           // crop width to be origHeight * newAspect
           if (origAspect > newAspect) {
               int tw = (origHeight * newWidth) / newHeight;
               // System.out.println((origWidth - tw) / 2+" "+)
               r = opencv_core.cvRect((origWidth - tw) / 2, 0, tw, origHeight);
           } else { // crop height to be origWidth / newAspect
               int th = (origWidth * newHeight) / newWidth;
               r = opencv_core.cvRect(0, (origHeight - th) / 2, origWidth, th);
           }
           IplImage croppedImg = cropImage(origImg, r);

           // Call this function again, with the new aspect ratio image.
           // Will do a scaled image resize with the correct aspect ratio.
           outImg = resizeImage(croppedImg, newWidth, newHeight, false);
           opencv_core.cvReleaseImage(croppedImg);

       } else {

           // Scale the image to the new dimensions,
           // even if the aspect ratio will be changed.
           outImg = opencv_core.cvCreateImage(
                   opencv_core.cvSize(newWidth, newHeight), origImg.depth(),
                   origImg.nChannels());
           if (newWidth > origImg.width() && newHeight > origImg.height()) {
               // Make the image larger
               opencv_core.cvResetImageROI((IplImage) origImg);
               // CV_INTER_LINEAR: good at enlarging.
               // CV_INTER_CUBIC: good at enlarging.
               cvResize(origImg, outImg, CV_INTER_LINEAR);
           } else {
               // Make the image smaller
               opencv_core.cvResetImageROI((IplImage) origImg);
               // CV_INTER_AREA: good at shrinking (decimation) only.
               cvResize(origImg, outImg, CV_INTER_AREA);
           }

       }
       return outImg;
    }

    // Returns a new image that is a cropped version (rectangular cut-out)
    // of the original image.
    IplImage cropImage(IplImage img, CvRect region) {
       IplImage imageCropped;
       opencv_core.CvSize size = new CvSize();

       if (img.width() <= 0 || img.height() <= 0 || region.width() <= 0
               || region.height() <= 0) {
           // cerr << "ERROR in cropImage(): invalid dimensions." << endl;
           return null;
       }

       if (img.depth() != opencv_core.IPL_DEPTH_8U) {
           // cerr << "ERROR in cropImage(): image depth is not 8." << endl;
           return null;
       }

       // Set the desired region of interest.
       opencv_core.cvSetImageROI((IplImage) img, region);
       // Copy region of interest into a new iplImage and return it.
       size.width(region.width());
       size.height(region.height());
       imageCropped = opencv_core.cvCreateImage(size,
               opencv_core.IPL_DEPTH_8U, img.nChannels());
       opencv_core.cvCopy(img, imageCropped); // Copy just the region.

       return imageCropped;
    }

    public IplImage rotate(IplImage image, double angle) {
       IplImage copy = opencv_core.cvCloneImage(image);

       IplImage rotatedImage = opencv_core.cvCreateImage(
               opencv_core.cvGetSize(copy), copy.depth(), copy.nChannels());
       CvMat mapMatrix = opencv_core.cvCreateMat(2, 3, opencv_core.CV_32FC1);

       // Define Mid Point
       CvPoint2D32f centerPoint = new CvPoint2D32f();
       centerPoint.x(copy.width() / 2);
       centerPoint.y(copy.height() / 2);

       // Get Rotational Matrix
       opencv_imgproc.cv2DRotationMatrix(centerPoint, angle, 1.0, mapMatrix);

       // Rotate the Image
       opencv_imgproc.cvWarpAffine(copy, rotatedImage, mapMatrix,
               opencv_imgproc.CV_INTER_CUBIC
                       + opencv_imgproc.CV_WARP_FILL_OUTLIERS,
               opencv_core.cvScalarAll(170));
       opencv_core.cvReleaseImage(copy);
       opencv_core.cvReleaseMat(mapMatrix);
       return rotatedImage;
    }

    I am rotating the video frame and then resizing the frame image.

    The code was working fine 3 days ago but not suddenly it started messing up.