Recherche avancée

Médias (91)

Autres articles (51)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, 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 (...)

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

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (4877)

  • Catching dropped FFMPEG frames in iOS ?

    30 juin 2020, par jbeu425

    I'm developing an iOS app which streams RTSP over a WiFi connection. I need to be able to inform the user if the connection is not good, and I'd like to know if there is some way to catch dropped FFMPEG frames in some way ?

    


    My frames are decoded using the method below, is there somewhere here I can tap into to catch an issue with the frame being decoded ? There is currently an NSLog which says "decode video error !" about half way down this method, but running network link conditioner set to "very poor network" never reaches this line even though the stream is very choppy.

    


    All I'm after really is some sort of line that I can breakpoint when the stream loses quality because of a bad connection.

    


    - (NSArray *) decodeFrames: (CGFloat) minDuration
{
NSMutableArray *result = [NSMutableArray array];

@synchronized (lock) {
    
    if([_reading integerValue] != 1){
        
        _reading = [NSNumber numberWithInt:1];
        
        @synchronized (_seekPosition) {
            if([_seekPosition integerValue] != -1 && _seekPosition){
                [self seekDecoder:[_seekPosition longLongValue]];
                _seekPosition = [NSNumber numberWithInt:-1];
            }
        }
        
        if (_videoStream == -1 &&
            _audioStream == -1)
            return nil;
        
        AVPacket packet;
        
        CGFloat decodedDuration = 0;
        
        CGFloat totalDuration = [TimeHelper calculateTimeDifference];
        CGFloat timeStampAtEntry = av_frame_get_best_effort_timestamp(_videoFrame) * _videoTimeBase;
        NSDate *timeAtEntry = [NSDate date];
        BOOL catchUp = totalDuration > 0;
        do {
        BOOL finished = NO;
        
        while (!finished) {
            
                NSDate* snap1 = [NSDate date];
            if (av_read_frame(_formatCtx, &packet) < 0) {
                _isEOF = YES;
                    catchUp = NO;
                [self endOfFileReached];
                break;
            }
            
            [self frameRead];
            
                if ([[NSDate date] timeIntervalSinceDate:snap1] > 3) {
                    _isEOF = YES;
                    catchUp = NO;
                    [self endOfFileReached];
                    break;
                }
            if (packet.stream_index ==_videoStream) {
                
                int pktSize = packet.size;
                

                while (pktSize > 0) {
                    
                    int gotframe = 0;
                    int len = avcodec_decode_video2(_videoCodecCtx,
                                                    _videoFrame,
                                                    &gotframe,
                                                    &packet);
                    
                    if (len < 0) {
                        LoggerVideo(0, @"decode video error, skip packet");
                        NSLog(@"decode video error!");
                        break;
                    }
                    
                    if (gotframe) {
                        
                            if (catchUp ) {
                                CGFloat timeStamp = av_frame_get_best_effort_timestamp(_videoFrame) * _videoTimeBase;
                                catchUp = totalDuration > (timeStamp - timeStampAtEntry);
                                if (!catchUp) {
                                    CGFloat nextTotalDuration = [[NSDate date] timeIntervalSinceDate:timeAtEntry];
                                    if (nextTotalDuration < totalDuration && nextTotalDuration > 0.5) {
                                        totalDuration = nextTotalDuration;
                                        timeAtEntry = [NSDate date];
                                        timeStampAtEntry = timeStamp;                                            
                                        catchUp = true;
                                    }
                                }
                                if ([configuration.recordStream intValue] == 1) {
                                    [self writeToFile: packet];
                                }
                                
                            } else {
                                
                        if (!_disableDeinterlacing &&
                            _videoFrame->interlaced_frame) {
                            
                            avpicture_deinterlace((AVPicture*)_videoFrame,
                                                  (AVPicture*)_videoFrame,
                                                  _videoCodecCtx->pix_fmt,
                                                  _videoCodecCtx->width,
                                                  _videoCodecCtx->height);
                        }
                        
                        KxVideoFrame *frame = [self handleVideoFrame];
                        if (frame) {
                            
                            [result addObject:frame];
                            _position = frame.position;
                            decodedDuration += frame.duration;
                            if (decodedDuration > minDuration)
                                finished = YES;
                        }
                                

                                if ([configuration.recordStream intValue] == 1) {
                                    [self writeToFile: packet];
                                }
                                
                                
                                
                            }
                        }
                        
                        if (0 == len)
                        break;
                    
                    pktSize -= len;
                    }
                }
                
                
                
                
                av_free_packet(&packet);
        }
        } while (catchUp);
        _reading = [NSNumber numberWithInt:0];
        [TimeHelper resetTimeEnteredForeground];
        [TimeHelper resetTimeEnteredBackground];
        
        return result;
    }
    
    }

    return result;

    }


    


  • dockerfile apt-get install ffmpeg unmet dependencies

    8 juillet 2020, par Martin

    I have a Dockerfile which looks like this :

    


    FROM node:carbon
VOLUME ["/root"]
ADD setup-ffmpeg.sh /root
RUN /root/setup-ffmpeg.sh
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "npm", "start" ]


    


    Which tries to run the file setup-ffmpeg.sh :

    


    #!/usr/bin/env bash
echo 'deb http://www.deb-multimedia.org jessie main non-free' >> /etc/apt/sources.list
echo 'deb-src http://www.deb-multimedia.org jessie main non-free' >> /etc/apt/sources.list
apt-get update
apt-get install -y --force-yes deb-multimedia-keyring
apt-get remove -y --force-yes ffmpeg
apt-get install -y --force-yes build-essential libmp3lame-dev libvorbis-dev libtheora-dev     libspeex-dev yasm pkg-config libfaac-dev libx264-dev libav-tools 
echo "ffmpeg time"
apt-get install ffmpeg 


    


    I am on Ubuntu 20.04 LTS, and try to run this the Dockerfile, from terminal, with the command :

    


    docker build -t alien35/node-web-app .


    


    This causes an error when reaching the ffmpeg part though :

    


    Sending build context to Docker daemon  9.793MB
Step 1/10 : FROM node:carbon
 ---> 8eeadf3757f4
Step 2/10 : VOLUME ["/root"]
 ---> Using cache
 ---> 3658672462de
Step 3/10 : ADD setup-ffmpeg.sh /root
 ---> c9c192aa97c5
Step 4/10 : RUN /root/setup-ffmpeg.sh
 ---> Running in b9240ac8d351
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://deb.debian.org/debian stretch Release.gpg [2410 B]
Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [529 kB]
Get:7 http://deb.debian.org/debian stretch-updates/main amd64 Packages [28.2 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [7083 kB]
Get:9 http://www.deb-multimedia.org jessie InRelease [24.6 kB]
Ign:9 http://www.deb-multimedia.org jessie InRelease
Get:10 http://www.deb-multimedia.org jessie/main Sources [60.8 kB]
Get:11 http://www.deb-multimedia.org jessie/non-free Sources [2480 B]
Get:12 http://www.deb-multimedia.org jessie/main amd64 Packages [82.8 kB]
Get:13 http://www.deb-multimedia.org jessie/non-free amd64 Packages [1776 B]
Fetched 8080 kB in 2s (3402 kB/s)
Reading package lists...
W: GPG error: http://www.deb-multimedia.org jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5C808C2B65558117
W: The repository 'http://www.deb-multimedia.org jessie InRelease' is not signed.
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  deb-multimedia-keyring
0 upgraded, 1 newly installed, 0 to remove and 56 not upgraded.
Need to get 10.7 kB of archives.
After this operation, 25.6 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  deb-multimedia-keyring
Get:1 http://www.deb-multimedia.org jessie/main amd64 deb-multimedia-keyring all 2016.8.1 [10.7 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 10.7 kB in 0s (23.3 kB/s)
Selecting previously unselected package deb-multimedia-keyring.
(Reading database ... 29962 files and directories currently installed.)
Preparing to unpack .../deb-multimedia-keyring_2016.8.1_all.deb ...
Unpacking deb-multimedia-keyring (2016.8.1) ...
Setting up deb-multimedia-keyring (2016.8.1) ...
W: --force-yes is deprecated, use one of the options starting with --allow instead.
W: --force-yes is deprecated, use one of the options starting with --allow instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package 'ffmpeg' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 56 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
pkg-config is already the newest version (0.29-4+b1).
pkg-config set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libav-tools : Depends: ffmpeg (= 10:2.6.9-dmo1+deb8u2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
ffmpeg time
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ffmpeg : Depends: libavcodec56 (>= 10:2.6.9) but it is not going to be installed
          Depends: libavdevice56 (>= 10:2.6.9) but it is not going to be installed
          Depends: libavfilter5 (>= 10:2.6.9) but it is not going to be installed
          Depends: libavformat56 (>= 10:2.6.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c /root/setup-ffmpeg.sh' returned a non-zero code: 100


    


    I have tried adding the dependencies to apt-get install in my Dockerfile, and adding -f to the ffmpeg command as well, but I am still getting this error

    


  • FFmpeg - center crop image overlay

    21 juillet 2020, par ClassA

    Here is the information about my input files, player and command I'm using :

    


    enter image description here

    


      

    • Input Video Dimensions = 1080 x 1920
    • 


    • Input Image Dimensions (overlay - Red in image) = 1080 x 1794
    • 


    • Player dimensions (Black in image) = 1080 x 1794
    • 


    • Video size (scaled to fit in player - Blue in image) = 1010 x 1794
    • 


    


    My current command is :

    


    -ffmpeg -ss valueLeft -i inputVideo -i inputOverlay -t to -filter_complex scale=playerWidth:trunc(ow/a/2)*2,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2 -c:v libx264 -preset ultrafast outputPath


    


    The playerWidth is the width of the video, scaled to fit in the player (blue/video in the image above).

    



    


    The problem I have is that the video is scaled inside the player to fit inside the player, this means that I might have values like 999.

    


    To counter this, I can change the width to 998 or 1000, but the overlay image will be out by one pixel. I know one pixel is not a lot, but in my use case, it has to be precisely the same as it was in the player.

    


    Besides that, the video aspect ratio will also change when doing this.

    


    My question :

    


    How can I center crop the overlay, despite the size of the video or the overlay image, to get the following result :

    


    enter image description here

    


    EDIT :
It would be great if I could instead use the video's original dimensions and crop the overlay (if it is bigger than the video).