Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (8)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

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

Sur d’autres sites (2861)

  • Trying to open file with PHP-FFMpeg after it was encoded once

    19 mai 2016, par Shillo Ben David

    in the same PHP process I’m trying to open a file that was manipulated and saved, and then I’m trying to open it with as a new FFMpeg\Video. For example, in the same process :

    Open -> original.MOV
     Manipulate & save to -> new.mp4
       Open -> new.mp4

    However when I’m trying to open the manipulated file I get this InvalidArgumentException exception :

    InvalidArgumentException: Unable to detect file format, only audio and video supported

    It’s thrown by the FFMpeg::open() after it could not detect that it’s a either Video or Audio stream.

    FFMpeg::open()

    public function open($pathfile)
    {
       if (null === $streams = $this->ffprobe->streams($pathfile)) {
           throw new RuntimeException(sprintf('Unable to probe "%s".', $pathfile));
       }

       if (0 < count($streams->videos())) {
           return new Video($pathfile, $this->driver, $this->ffprobe);
       } elseif (0 < count($streams->audios())) {
           return new Audio($pathfile, $this->driver, $this->ffprobe);
       }

       throw new InvalidArgumentException('Unable to detect file format, only audio and video supported');
    }

    The filters I applied to the video are audio mute and speedup (setpts).

    So I wonder, why FFMpeg doesn’t recognise it as video ?

  • C++ FFmpeg pitch issue

    24 janvier 2016, par David Andrei Norgren

    I’m using swr_convert to lower/raise the pitch of incoming audio and store it in a .mp3. To change the pitch, I’m dividing the out sample rate by a factor. However, the resulting audio is slightly distorted when this factor is anything other than 1. Here’s my conversion code :

    ...

    // Set up resample context
    swrContext = swr_alloc();
    if (!swrContext)
       throw -15;

    av_opt_set_int(swrContext, "in_channel_count", codecContext->channels, 0);
    av_opt_set_int(swrContext, "in_channel_layout", codecContext->channel_layout, 0);
    av_opt_set_int(swrContext, "in_sample_rate", codecContext->sample_rate, 0);
    av_opt_set_sample_fmt(swrContext, "in_sample_fmt", codecContext->sample_fmt, 0);

    av_opt_set_int(swrContext, "out_channel_count", STREAM_AUDIO_CHANNELS, 0);
    av_opt_set_int(swrContext, "out_channel_layout", STREAM_AUDIO_CHANNEL_LAYOUT, 0);
    av_opt_set_int(swrContext, "out_sample_rate", STREAM_AUDIO_SAMPLE_RATE / pitch, 0);
    av_opt_set_sample_fmt(swrContext, "out_sample_fmt", STREAM_AUDIO_SAMPLE_FORMAT_GM, 0);

    if (swr_init(swrContext))
       throw -16;

    // Allocate re-usable frame
    frameDecoded = av_frame_alloc();
    if (!frameDecoded)
       throw -17;

    frameDecoded->format = codecContext->sample_fmt;
    frameDecoded->channel_layout = codecContext->channel_layout;
    frameDecoded->channels = codecContext->channels;
    frameDecoded->sample_rate = codecContext->sample_rate;

    // Load frames
    inPacket.data = NULL;
    inPacket.size = 0;

    int gotFrame, samples = 0;

    while (av_read_frame(formatContext, &inPacket) >= 0) {

       if (inPacket.stream_index != streamId)
           continue;

       if (avcodec_decode_audio4(codecContext, frameDecoded, &gotFrame, &inPacket) < 0)
           throw -18;

       if (!gotFrame)
           continue;

       // Begin conversion
       if (swr_convert(swrContext, NULL, 0, (const uint8_t **)frameDecoded->data, frameDecoded->nb_samples) < 0)
           throw -19;

       while (swr_get_out_samples(swrContext, 0) >= RAW_AUDIO_FRAME_SIZE) {

           // Allocate data
           uint8_t **convertedData = NULL;
           if (av_samples_alloc_array_and_samples(&convertedData, NULL, STREAM_AUDIO_CHANNELS, RAW_AUDIO_FRAME_SIZE, STREAM_AUDIO_SAMPLE_FORMAT_GM, 0) < 0)
               throw -20;

           // Convert
           if (swr_convert(swrContext, convertedData, RAW_AUDIO_FRAME_SIZE, NULL, 0) < 0)
               throw -21;

           // Calculate buffer size
           size_t bufferSize = av_samples_get_buffer_size(NULL, STREAM_AUDIO_CHANNELS, RAW_AUDIO_FRAME_SIZE, STREAM_AUDIO_SAMPLE_FORMAT_GM, 0);
           if (bufferSize < 0)
               throw -22;

           fwrite(convertedData[0], 1, bufferSize, outStream);
           av_free(convertedData);
       }
    }

    ...

    STREAM_AUDIO_SAMPLE_RATE is defined as 44100.
    Here’s the entire program if it helps : http://pastebin.com/5akEwNg4

    The program generates a .mp3 with 25 notes that decrease in pitch.
    Here’s an example of the distortion : http://www.stuffbydavid.com/dl/30256478.mp3

    Can you spot anything incorrect about my conversion, or is my method of changing the pitch incorrect ? Is there another way ?

  • FFmpeg watermark duration

    4 mai 2016, par user2364292

    I am developing an Android app, which will work with FFmpeg library which only applies multiple watermarks on some test.mp4 video. For that case I am using the Android java library for FFmpeg binary from that source : [http://writingminds.github.io/ffmpeg-android-java/] which is working fine for some examples, but I just can not use commands like these :

    -i /storage/emulated/0/Download/test.mp4 -vf "movie=/storage/emulated/0/Download/test.mp4 [logo]; [in][logo] overlay=W-w-10:H-h-10, fade=in:0:20 [out]" /storage/emulated/0/Download/test.mp4

    Please note these quotes after -vf flag and these [in], [logo] flags. These just throw me an errors like

    [NULL @ 0xb5bf3200] Unable to find a suitable output format for '[logo];'
    [logo];: Invalid argument

    and so on. The quotes in the command are also the problem which throws me an error like :

    [AVFilterGraph @ 0xb5c092c0] No such filter: 'overlay=main_w-50:main_h-50,overlay=0:0'
    Error initializing complex filters.
    Invalid argument".

    Am I even using proper library for that case ? I also want to show the watermark in specific duration of the video. For example if video is 10 seconds long, I only want watermark to be shown starting from 3rd second of the video to 7th second. I can show the overlay images like this :

    -i /storage/emulated/0/Download/test.mp4 -i /storage/emulated/0/Download/test.jpg -i /storage/emulated/0/Download/test.jpg -filter_complex overlay=main_w-50:main_h-50,overlay=0:0 -codec:a copy /storage/emulated/0/Download/test_edited.mp4

    but they’re shown for the whole video duration. Where can I set the duration start/end for the specific overlay ?

    Thank you very much !