Recherche avancée

Médias (1)

Mot : - Tags -/iphone

Autres articles (103)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

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

Sur d’autres sites (8341)

  • How do I extract the first frame of a video stream as an image using avcpp ?

    19 mars 2023, par AurelaNYT

    I'm trying to extract the first frame of a video stream and save it as an image using the avcpp library (https://github.com/h4tr3d/avcpp). I have already written some code but I'm not sure how to extract the first frame from the stream and save it to a .JPG file. Can someone help me with this ?

    


    I have done the following for now and it works fine, however I am unable to understand how to go on with the conversion of the frame to an image :

    


    #include "iostream"
#include "avcpp/av.h"
#include "avcpp/codec.h"
#include "avcpp/frame.h"
#include "avcpp/packet.h"
#include "avcpp/codeccontext.h"
#include "avcpp/formatcontext.h"

class OpenVHCR {
public:

    static void getFirstFrame(const std::string& stream_uri, const bool debug_log) {
        av::init();
        av::Codec videoCodec;
        av::Stream videoStream;
        size_t videoStreamID = -1;
        std::error_code errorCode;
        av::FormatContext formatContext;
        av::VideoDecoderContext decoderContext;
        formatContext.openInput(stream_uri);
        if(formatContext.streamsCount() < 1){
            std::cerr << "[I/O] Failed to find a video steam in the URI provided." << std::endl;
        }else{
            if(debug_log){
                std::cout << "[I/O] Successfully found " <<  formatContext.streamsCount() << " streams in the URI provided." << std::endl;
            }
            formatContext.findStreamInfo(errorCode);
            if (errorCode) {
                std::cerr << "[AV] An unexpected error has occurred: " << errorCode.message() << std::endl;
                return;
            }
            for (size_t i = 0; i < formatContext.streamsCount(); ++i) {
                auto st = formatContext.stream(i);
                if (st.mediaType() == AVMEDIA_TYPE_VIDEO) {
                    videoStreamID = i;
                    videoStream = st;
                    break;
                }
            }
            if(!videoStream.isNull() && videoStream.isValid()){
                if(debug_log){
                    std::cout << "[I/O] Successfully opened a valid video stream." << std::endl;
                }
                decoderContext = av::VideoDecoderContext(videoStream);
                videoCodec = av::findDecodingCodec(decoderContext.raw()->codec_id);
                decoderContext.setCodec(videoCodec);
                decoderContext.setRefCountedFrames(true);
                decoderContext.open({{"threads", "1"}}, av::Codec(), errorCode);
                if(errorCode){
                    std::cout << "[AV] Failed to find a supported codec for the stream." << std::endl;
                    return;
                }else{
                    while (av::Packet streamPacket = formatContext.readPacket(errorCode)){
                        if(errorCode){
                            std::cout << "[AV] Failed to read  a packet from the stream." << std::endl;
                            return;
                        }else{
                            std::cout << "[AV] Successfully read a packet from the stream." << std::endl;
                            if(streamPacket.streamIndex() != videoStreamID){
                                continue;
                            }
                            //TODO: Find a way to get the first frame from the stream and save it as an image.
                            av::VideoFrame videoFrame = decoderContext.decode(streamPacket, errorCode);
                            std::cout << "[AV] Successfully received a frame from the video." << std::endl;
                            if (errorCode) {
                                std::cerr << "[AV] An unexpected error has occurred: " << errorCode.message() << std::endl;
                                return;
                            } else if (!videoFrame) {
                                std::cerr << "[AV] The received video frame seems to be empty." << std::endl;
                            }
                        }
                    }

                    formatContext.close();
                    decoderContext.close();
                }
            }else{
                std::cerr << "[I/O] Failed to find open a valid video stream." << std::endl;
            }
        }
    }
};



    


  • FFmpeg auto rotate video when copying video stream without re-encoding

    25 février 2019, par Mahfujur Rahman

    I have been trying to convert an mp4 (portrait) file to mkv. As the mkv container support any video and audio stream, I am copying the audio and video stream to the output container. The command I’m using

    ffmpeg -y -i test.mp4 -vcodec copy -acodec copy test.mkv

    File info for test.mp4 is following

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       creation_time   : 2019-02-23T11:18:50.000000Z
       com.android.version: 8.0.0
     Duration: 00:00:25.86, start: 0.000000, bitrate: 12270 kb/s
       Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 12005 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         rotate          : 90
         creation_time   : 2019-02-23T11:18:50.000000Z
         handler_name    : VideoHandle
       Side data:
         displaymatrix: rotation of -90.00 degrees
       Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
       Metadata:
         creation_time   : 2019-02-23T11:18:50.000000Z
         handler_name    : SoundHandle

    Now, the problem is that the output video I get from ffmpeg is a 90 degree counter clockwise rotated video. The reason I believe is the following info being removed from output file,

    Side data:
    displaymatrix: rotation of -90.00 degrees

    File info for rotated output file test.mkv

    Input #0, matroska,webm, from 'test.mkv':
     Metadata:
       MAJOR_BRAND     : mp42
       MINOR_VERSION   : 0
       COMPATIBLE_BRANDS: isommp42
       COM.ANDROID.VERSION: 8.0.0
       ENCODER         : Lavf58.12.100
     Duration: 00:00:25.87, start: 0.000000, bitrate: 12265 kb/s
       Stream #0:0(eng): Video: h264, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
       Metadata:
         ROTATE          : 90
         HANDLER_NAME    : VideoHandle
         DURATION        : 00:00:25.866000000
       Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, fltp (default)
       Metadata:
         HANDLER_NAME    : SoundHandle
         DURATION        : 00:00:25.813000000

    But when I convert this rotated output test.mkv to mp4 again, I get the portrait file. The displaymatrix side data appears again in the file info.

    Converting the same mp4 file to m4v by copying the steam works fine.

    So, this whole thing is very much confusing to me.

    Now my question is, how can I convert the mp4 file to mkv without re-encoding and avoid getting rotated output ?

    In this post they solved it for c++. I am working on android and using ffmpeg android wrapper to use the ffmpeg library. Is there any ffmpeg flag to handle this situation ?

  • libavutil : introduce AVFilmGrainParams side data

    12 novembre 2020, par Lynne
    libavutil : introduce AVFilmGrainParams side data
    

    This patch introduces a new frame side data type AVFilmGrainParams for use
    with video codecs which support it.

    It can save a lot of memory used for duplicate processed reference frames and
    reduce copies when applying film grain during presentation.

    • [DH] doc/APIchanges
    • [DH] libavutil/Makefile
    • [DH] libavutil/film_grain_params.c
    • [DH] libavutil/film_grain_params.h
    • [DH] libavutil/frame.c
    • [DH] libavutil/frame.h
    • [DH] libavutil/version.h