Recherche avancée

Médias (0)

Mot : - Tags -/médias

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (46)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (4248)

  • Understanding Data Processing Agreements and How They Affect GDPR Compliance

    9 octobre 2023, par Erin — GDPR

    The General Data Protection Regulation (GDPR) impacts international organisations that conduct business or handle personal data in the European Union (EU), and they must know how to stay compliant.

    One way of ensuring GDPR compliance is through implementing a data processing agreement (DPA). Most businesses overlook DPAs when considering ways of maintaining user data security. So, what exactly is a DPA’s role in ensuring GDPR compliance ?

    In this article, we’ll discuss DPAs, their advantages, which data protection laws require them and the clauses that make up a DPA. We’ll also discuss the consequences of non-compliance and how you can maintain GDPR compliance using Matomo.

    What is a data processing agreement ?

    A data processing agreement, data protection agreement or data processing addendum is a contractual agreement between a data controller (a company) and a data processor (a third-party service provider.) It defines each party’s rights and obligations regarding data protection.

    A DPA also defines the responsibilities of the controller and the processor and sets out the terms they’ll use for data processing. For instance, when MHP/Team SI sought the services of Matomo (a data processor) to get reliable and compliant web analytics, a DPA helped to outline their responsibilities and liabilities.

    A DPA is one of the basic requirements for GDPR compliance. The GDPR is an EU regulation concerning personal data protection and security. The GDPR is binding on any company that actively collects data from EU residents or citizens, regardless of their location.

    As a business, you need to know what goes into a DPA to identify possible liabilities that may arise if you don’t comply with European data protection laws. For example, having a recurrent security incident can lead to data breaches as you process customer personal data.

    The average data breach cost for 2023 is $4.45 million. This amount includes regulatory fines, containment costs and business losses. As such, a DPA can help you assess the organisational security measures of your data processing methods and define the protocol for reporting a data breach.

    Why is a DPA essential for your business ?

    If your company processes personal data from your customers, such as contact details, you need a DPA to ensure compliance with data security laws like GDPR. You’ll also need a DPA to hire a third party to process your data, e.g., through web analytics or cloud storage.

    But what are the benefits of having a DPA in place ?

    Benefits of a data processing agreement

    A key benefit of signing a DPA is it outlines business terms with a third-party data processor and guarantees compliance with the relevant data privacy laws. A DPA also helps to create an accountability framework between you and your data processor by establishing contractual obligations.

    Additionally, a DPA helps to minimise the risk of unauthorised access to sensitive data. A DPA defines organisational measures that help protect the rights of individuals and safeguard personal data against unauthorised disclosure. Overall, before choosing a data processor, having a DPA ensures that they are capable, compliant and qualified.

    More than 120 countries have already adopted some form of international data protection laws to protect their citizens and their data better. Hence, knowing which laws require a DPA and how you can better ensure compliance is important.

    Which data protection laws require a DPA ?

    Regulatory bodies enact data protection laws to grant consumers greater control over their data and how businesses use it. These laws ensure transparency in data processing and compliance for businesses.

    Data protection laws that require a DPA

    The following are some of the relevant data privacy laws that require you to have a DPA :

    • UK GDPR
    • Brazil LGPD
    • EU GDPR
    • Dubai PDPA
    • Colorado CPA
    • California CCPA/CPRA
    • Virginia VCDPA
    • Connecticut DPA
    • South African POPIA
    • Thailand PDPA

    Companies that don’t adhere to these data protection obligations usually face liabilities such as fines and penalties. With a DPA, you can set clear expectations regarding data processing between you and your customers.

    Review and update any DPAs with third-party processors to ensure compliance with GDPR and the laws we mentioned above. Additionally, confirm that all the relevant clauses are present for compliance with relevant data privacy laws. 

    So, what key data processing clauses should you have in your DPA ? Let’s take a closer look in the next section.

    Key clauses in a data processing agreement

    GDPR provides some general recommendations for what you should state in a DPA.

    Key elements found in a DPA

    Here are the elements you should include :

    Data processing specifications

    Your DPA should address the specific business purposes for data processing, the duration of processing and the categories of data under processing. It should also clearly state the party responsible for maintaining GDPR compliance and who the data subjects are, including their location and nationality.

    Your DPA should also address the data processor and controller’s responsibilities concerning data deletion and contract termination.

    Role of processor

    Your DPA should clearly state what your data processor is responsible for and liable for. Some key responsibilities include record keeping, reporting breaches and maintaining data security.

    Other roles of your data processor include providing you with audit opportunities and cooperating with data protection authorities during inquiries. If you decide to end your contract, the data processor is responsible for deleting or returning data, depending on your agreement.

    Role of controller

    Your DPA should inform the responsibilities of the data controller, which typically include issuing processing instructions to the data processor and directing them on how to handle data processing.

    Your DPA should let you define the lawful data processes the data processor should follow and how you’ll uphold the data protection rights of individuals’ sensitive data.

    Organisational and technical specifications

    Your DPA should define specifications such as how third-party processors encrypt, access and test personal data. It should also include specifications on how the data processor and controller will maintain ongoing data security through various factors such as :

    • State of the technology : Do ‌third-party processors have reliable technology, and can they ensure data security within their systems ?
    • Costs of implementation : Does the data controller’s budget allow them to seek third-party services from industry-leading providers who can guarantee a certain level of security ?
    • Variances in users’ personal freedom : Are there privacy policies and opt-out forms for users to express how they want companies to use their sensitive data ?

    Moreover, your DPA should define how you and your data processor will ensure the confidentiality, availability and integrity of data processing services and systems.

    What are the penalties for DPA GDPR non-compliance ?

    Regulators use GDPR’s stiff fines to encourage data controllers and third-party processors to follow‌ best data security practices. One way of maintaining compliance is through drafting up a DPA with your data processor.

    The DPA should clearly outline the necessary legal requirements and include all the relevant clauses mentioned above. Understand what goes into this agreement since data protection authorities can hold your business accountable for a breach — even if a processor’s error caused it.

    Data protection authorities can issue penalties now that the GDPR is in place. For example, according to Article 83 of the GDPR, penalties for data or privacy breaches or non-compliance can amount to up to €20 million or 4% of your annual revenue.

    There are two tiers of fines : tier one and tier two. Violations related to data processors typically attract fines on the tier-one level. Tier one fines can cost your business €10 million or 2% of your company’s global revenue.

    Tier-two fines result from infringement of the right to forget and the right to privacy of your consumer. Tier-two fines can cost your business up to €20 million or 4% of your company’s global revenue.

    GDPR fines make non-compliance an expensive mistake for businesses of all sizes. As such, signing a DPA with any party that acts as a data processor for your business can help you remain GDPR-compliant.

    How a DPA can help your business remain GDPR compliant

    A DPA can help your business define and adhere to lawful data processes.

    Steps to take to be DPA GDPR compliant

    So, in what other ways can a DPA help you to remain compliant with GDPR ? Let’s take a look !

    1. Assess data processor’s compliance

    Having a DPA helps ensure that the data processor you are working with is GDPR-compliant. You should check if they have a DPA and confirm the processor’s terms of service and legal basis.

    For example, if you want an alternative to Google Analytics that’s GDPR compliant, then you can opt for Matomo. Matomo features a DPA, which you can agree to when you sign up for web analytics services or later.

    2. Establish lawful data processes

    A DPA can also help you review your data processes to ensure they’re GDPR compliant. For example, by defining lawful data processes, you better understand personally identifiable information (PII) and how it relates to data privacy.

    Further, you can allow users to opt out of sharing their data. As such, Matomo can help you to enable Do Not Track preferences on your website.

    With this feature, users are given the option to opt in or out of tracking via a toggle in their respective browsers.

    Indeed, establishing lawful data processes helps you define the specific business purposes for collecting and processing personal data. By doing so, you get to notify your users why you need their data and get their consent to process it by including a GDPR-compliant privacy policy on your website.

    3. Anonymise your data

    Global privacy laws like GDPR and ePrivacy mandate companies to display cookie banners or seek consent before tracking visitors’ data. You can either include a cookie consent banner on your site or stop tracking cookies to follow the applicable regulations.

    Further, you can enable cookie-less tracking or easily let users opt out. For example, you can use Matomo without a cookie consent banner, exempting it from many countries’ privacy rules.

    Additionally, through a DPA, you can define organisational measures that define how you’ll anonymise all your users’ data. Matomo can help you anonymise IP addresses, and we recommend that you at least anonymise the last two bytes.

    As one of the few web analytics tools you can use to collect data without tracking consent, Matomo also has the French Data Protection Authority (CNIL) approval.

    4. Assess the processor’s bandwidth

    Having a DPA can help you implement data retention policies that show clear retention periods. Such policies are useful when ending a contract with a third-party service provider and determining how they should handle your data.

    A DPA also helps you ensure the processor has the necessary technology to store personal data securely. You can conduct an audit to understand possible vulnerabilities and your data processor’s technological capacity.

    5. Obtain legal counsel

    When drafting a DPA, it’s important to get a consultation on what is needed to ensure complete compliance. Obtaining legal counsel points you in the right direction so you don’t make any mistakes that may lead to non-compliance.

    Conclusion

    Businesses that process users’ data are subject to several DPA contract requirements under GDPR. One of the most important is having DPAs with every third-party provider that helps them perform data processing.

    It’s important to stay updated on GDPR requirements for compliance. As such, Matomo can help you maintain lawful data processes. Matomo gives you complete control over your data and complies with GDPR requirements.

    To get started with Matomo, you can sign up for a 21-day free trial. No credit card required.

    Disclaimer

    We are not lawyers and don’t claim to be. The information provided here is to help give an introduction to GDPR. We encourage every business and website to take data privacy seriously and discuss these issues with your lawyer if you have any concerns.

  • FFmpeg C++ API : Using HW acceleration (VAAPI) to transcode video coming from a webcam [closed]

    16 avril 2024, par nicoh

    I'm actually trying to use HW acceleration with the FFmpeg C++ API in order to transcode the video coming from a webcam (which may vary from one config to another) into a given output format (i.e : converting the video stream coming from the webcam in MJPEG to H264 so that it can be written into a MP4 file).

    


    I already succeeded to achieve this by transferring the AVFrame output by the HW decoder from GPU to CPU, then transfer this to the HW encoder input (so from CPU to GPU).
This is not so optimized and on top of that, for the given above config (MJPEG => H264), I cannot provide the output of the decoder as an input for the encoder as the MJPEG HW decoder wants to output in RGBA pixel format, and the H264 encoder wants NV12. So I have to perform pixel format conversion on CPU side.

    


    That's why I would like to connect the output of the HW video decoder directly to the input of the HW encoder (inside the GPU).
To do this, I followed this example given by FFmpeg : https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/vaapi_transcode.c.

    


    This works fine when transcoding an AVI file with MJPEG inside to H264 but it fails when using a MJPEG stream coming from a webcam as input.
In this case, the encoder says :

    


    [h264_vaapi @ 0x5555555e5140] No usable encoding profile found.


    


    Below the code of the FFmpeg example I modified to connect on webcam instead of opening input file :

    


    /*&#xA; * Permission is hereby granted, free of charge, to any person obtaining a copy&#xA; * of this software and associated documentation files (the "Software"), to deal&#xA; * in the Software without restriction, including without limitation the rights&#xA; * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&#xA; * copies of the Software, and to permit persons to whom the Software is&#xA; * furnished to do so, subject to the following conditions:&#xA; *&#xA; * The above copyright notice and this permission notice shall be included in&#xA; * all copies or substantial portions of the Software.&#xA; *&#xA; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&#xA; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&#xA; * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL&#xA; * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&#xA; * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&#xA; * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN&#xA; * THE SOFTWARE.&#xA; */&#xA;&#xA;/**&#xA; * @file Intel VAAPI-accelerated transcoding API usage example&#xA; * @example vaapi_transcode.c&#xA; *&#xA; * Perform VAAPI-accelerated transcoding.&#xA; * Usage: vaapi_transcode input_stream codec output_stream&#xA; * e.g: - vaapi_transcode input.mp4 h264_vaapi output_h264.mp4&#xA; *      - vaapi_transcode input.mp4 vp9_vaapi output_vp9.ivf&#xA; */&#xA;&#xA;#include &#xA;#include &#xA;#include <iostream>&#xA;&#xA;//#define USE_INPUT_FILE&#xA;&#xA;extern "C"{&#xA;#include <libavutil></libavutil>hwcontext.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavdevice></libavdevice>avdevice.h>&#xA;}&#xA;&#xA;static AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;&#xA;static AVBufferRef *hw_device_ctx = NULL;&#xA;static AVCodecContext *decoder_ctx = NULL, *encoder_ctx = NULL;&#xA;static int video_stream = -1;&#xA;static AVStream *ost;&#xA;static int initialized = 0;&#xA;&#xA;static enum AVPixelFormat get_vaapi_format(AVCodecContext *ctx,&#xA;                                           const enum AVPixelFormat *pix_fmts)&#xA;{&#xA;    const enum AVPixelFormat *p;&#xA;&#xA;    for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p&#x2B;&#x2B;) {&#xA;        if (*p == AV_PIX_FMT_VAAPI)&#xA;            return *p;&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Unable to decode this file using VA-API." &lt;&lt; std::endl;&#xA;    return AV_PIX_FMT_NONE;&#xA;}&#xA;&#xA;static int open_input_file(const char *filename)&#xA;{&#xA;    int ret;&#xA;    AVCodec *decoder = NULL;&#xA;    AVStream *video = NULL;&#xA;    AVDictionary    *pInputOptions = nullptr;&#xA;&#xA;#ifdef USE_INPUT_FILE&#xA;    if ((ret = avformat_open_input(&amp;ifmt_ctx, filename, NULL, NULL)) &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Cannot open input file &#x27;" &lt;&lt; filename &lt;&lt; "&#x27;, Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return ret;&#xA;    }&#xA;#else&#xA;    avdevice_register_all();&#xA;    av_dict_set(&amp;pInputOptions, "input_format", "mjpeg", 0);&#xA;    av_dict_set(&amp;pInputOptions, "framerate", "30", 0);&#xA;    av_dict_set(&amp;pInputOptions, "video_size", "640x480", 0);&#xA;&#xA;    if ((ret = avformat_open_input(&amp;ifmt_ctx, "/dev/video0", NULL, &amp;pInputOptions)) &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Cannot open input file &#x27;" &lt;&lt; filename &lt;&lt; "&#x27;, Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return ret;&#xA;    }&#xA;#endif&#xA;&#xA;    ifmt_ctx->flags |= AVFMT_FLAG_NONBLOCK;&#xA;&#xA;    if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Cannot find input stream information. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return ret;&#xA;    }&#xA;&#xA;    ret = av_find_best_stream(ifmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &amp;decoder, 0);&#xA;    if (ret &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Cannot find a video stream in the input file. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return ret;&#xA;    }&#xA;    video_stream = ret;&#xA;&#xA;    if (!(decoder_ctx = avcodec_alloc_context3(decoder)))&#xA;        return AVERROR(ENOMEM);&#xA;&#xA;    video = ifmt_ctx->streams[video_stream];&#xA;    if ((ret = avcodec_parameters_to_context(decoder_ctx, video->codecpar)) &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "avcodec_parameters_to_context error. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return ret;&#xA;    }&#xA;&#xA;    decoder_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);&#xA;    if (!decoder_ctx->hw_device_ctx) {&#xA;        std::cout &lt;&lt; "A hardware device reference create failed." &lt;&lt; std::endl;&#xA;        return AVERROR(ENOMEM);&#xA;    }&#xA;    decoder_ctx->get_format    = get_vaapi_format;&#xA;&#xA;    if ((ret = avcodec_open2(decoder_ctx, decoder, NULL)) &lt; 0)&#xA;    {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Failed to open codec for decoding. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;    }&#xA;&#xA;    return ret;&#xA;}&#xA;&#xA;static int encode_write(AVPacket *enc_pkt, AVFrame *frame)&#xA;{&#xA;    int ret = 0;&#xA;&#xA;    av_packet_unref(enc_pkt);&#xA;&#xA;    AVHWDeviceContext *pHwDevCtx = reinterpret_cast(encoder_ctx->hw_device_ctx);&#xA;    AVHWFramesContext *pHwFrameCtx = reinterpret_cast(encoder_ctx->hw_frames_ctx);&#xA;&#xA;    if ((ret = avcodec_send_frame(encoder_ctx, frame)) &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Error during encoding. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        goto end;&#xA;    }&#xA;    while (1) {&#xA;        ret = avcodec_receive_packet(encoder_ctx, enc_pkt);&#xA;        if (ret)&#xA;            break;&#xA;&#xA;        enc_pkt->stream_index = 0;&#xA;        av_packet_rescale_ts(enc_pkt, ifmt_ctx->streams[video_stream]->time_base,&#xA;                             ofmt_ctx->streams[0]->time_base);&#xA;        ret = av_interleaved_write_frame(ofmt_ctx, enc_pkt);&#xA;        if (ret &lt; 0) {&#xA;            char errMsg[1024] = {0};&#xA;            std::cout &lt;&lt; "Error during writing data to output file. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;            return -1;&#xA;        }&#xA;    }&#xA;&#xA;end:&#xA;    if (ret == AVERROR_EOF)&#xA;        return 0;&#xA;    ret = ((ret == AVERROR(EAGAIN)) ? 0:-1);&#xA;    return ret;&#xA;}&#xA;&#xA;static int dec_enc(AVPacket *pkt, const AVCodec *enc_codec, AVCodecContext *pDecCtx)&#xA;{&#xA;    AVFrame *frame;&#xA;    int ret = 0;&#xA;&#xA;    ret = avcodec_send_packet(decoder_ctx, pkt);&#xA;    if (ret &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Error during decoding. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return ret;&#xA;    }&#xA;&#xA;    while (ret >= 0) {&#xA;        if (!(frame = av_frame_alloc()))&#xA;            return AVERROR(ENOMEM);&#xA;&#xA;        ret = avcodec_receive_frame(decoder_ctx, frame);&#xA;        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {&#xA;            av_frame_free(&amp;frame);&#xA;            return 0;&#xA;        } else if (ret &lt; 0) {&#xA;            char errMsg[1024] = {0};&#xA;            std::cout &lt;&lt; "Error while decoding. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;            goto fail;&#xA;        }&#xA;&#xA;        if (!initialized) {&#xA;            AVHWFramesContext *pHwFrameCtx = reinterpret_cast(decoder_ctx->hw_frames_ctx);&#xA;            &#xA;            /* we need to ref hw_frames_ctx of decoder to initialize encoder&#x27;s codec.&#xA;               Only after we get a decoded frame, can we obtain its hw_frames_ctx */&#xA;            encoder_ctx->hw_frames_ctx = av_buffer_ref(pDecCtx->hw_frames_ctx);&#xA;            if (!encoder_ctx->hw_frames_ctx) {&#xA;                ret = AVERROR(ENOMEM);&#xA;                goto fail;&#xA;            }&#xA;            /* set AVCodecContext Parameters for encoder, here we keep them stay&#xA;             * the same as decoder.&#xA;             * xxx: now the sample can&#x27;t handle resolution change case.&#xA;             */&#xA;            if(encoder_ctx->time_base.den == 1 &amp;&amp; encoder_ctx->time_base.num == 0)&#xA;            {&#xA;                encoder_ctx->time_base = av_inv_q(ifmt_ctx->streams[video_stream]->avg_frame_rate);&#xA;            }&#xA;            else&#xA;            {&#xA;                encoder_ctx->time_base = av_inv_q(decoder_ctx->framerate);&#xA;            }&#xA;            encoder_ctx->pix_fmt   = AV_PIX_FMT_VAAPI;&#xA;            encoder_ctx->width     = decoder_ctx->width;&#xA;            encoder_ctx->height    = decoder_ctx->height;&#xA;&#xA;            if ((ret = avcodec_open2(encoder_ctx, enc_codec, NULL)) &lt; 0) {&#xA;                char errMsg[1024] = {0};&#xA;                std::cout &lt;&lt; "Failed to open encode codec. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;                goto fail;&#xA;            }&#xA;&#xA;            if (!(ost = avformat_new_stream(ofmt_ctx, enc_codec))) {&#xA;                std::cout &lt;&lt; "Failed to allocate stream for output format." &lt;&lt; std::endl;&#xA;                ret = AVERROR(ENOMEM);&#xA;                goto fail;&#xA;            }&#xA;&#xA;            ost->time_base = encoder_ctx->time_base;&#xA;            ret = avcodec_parameters_from_context(ost->codecpar, encoder_ctx);&#xA;            if (ret &lt; 0) {&#xA;                char errMsg[1024] = {0};&#xA;                std::cout &lt;&lt; "Failed to copy the stream parameters. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;                goto fail;&#xA;            }&#xA;&#xA;            /* write the stream header */&#xA;            if ((ret = avformat_write_header(ofmt_ctx, NULL)) &lt; 0) {&#xA;                char errMsg[1024] = {0};&#xA;                std::cout &lt;&lt; "Error while writing stream header. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;                goto fail;&#xA;            }&#xA;&#xA;            initialized = 1;&#xA;        }&#xA;&#xA;        if ((ret = encode_write(pkt, frame)) &lt; 0)&#xA;            std::cout &lt;&lt; "Error during encoding and writing." &lt;&lt; std::endl;&#xA;&#xA;fail:&#xA;        av_frame_free(&amp;frame);&#xA;        if (ret &lt; 0)&#xA;            return ret;&#xA;    }&#xA;    return 0;&#xA;}&#xA;&#xA;int main(int argc, char **argv)&#xA;{&#xA;    const AVCodec *enc_codec;&#xA;    int ret = 0;&#xA;    AVPacket *dec_pkt;&#xA;&#xA;    if (argc != 4) {&#xA;        fprintf(stderr, "Usage: %s <input file="file" /> <encode codec="codec"> <output file="file">\n"&#xA;                "The output format is guessed according to the file extension.\n"&#xA;                "\n", argv[0]);&#xA;        return -1;&#xA;    }&#xA;&#xA;    ret = av_hwdevice_ctx_create(&amp;hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, NULL, NULL, 0);&#xA;    if (ret &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Failed to create a VAAPI device. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        return -1;&#xA;    }&#xA;&#xA;    dec_pkt = av_packet_alloc();&#xA;    if (!dec_pkt) {&#xA;        std::cout &lt;&lt; "Failed to allocate decode packet" &lt;&lt; std::endl;&#xA;        goto end;&#xA;    }&#xA;&#xA;    if ((ret = open_input_file(argv[1])) &lt; 0)&#xA;        goto end;&#xA;&#xA;    if (!(enc_codec = avcodec_find_encoder_by_name(argv[2]))) {&#xA;        std::cout &lt;&lt; "Could not find encoder &#x27;" &lt;&lt; argv[2] &lt;&lt; "&#x27;" &lt;&lt; std::endl;&#xA;        ret = -1;&#xA;        goto end;&#xA;    }&#xA;&#xA;    if ((ret = (avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, argv[3]))) &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Failed to deduce output format from file extension. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        goto end;&#xA;    }&#xA;&#xA;    if (!(encoder_ctx = avcodec_alloc_context3(enc_codec))) {&#xA;        ret = AVERROR(ENOMEM);&#xA;        goto end;&#xA;    }&#xA;&#xA;    ret = avio_open(&amp;ofmt_ctx->pb, argv[3], AVIO_FLAG_WRITE);&#xA;    if (ret &lt; 0) {&#xA;        char errMsg[1024] = {0};&#xA;        std::cout &lt;&lt; "Cannot open output file. Error code: " &lt;&lt; av_make_error_string(errMsg, 1024, ret) &lt;&lt; std::endl;&#xA;        goto end;&#xA;    }&#xA;&#xA;    /* read all packets and only transcoding video */&#xA;    while (ret >= 0) {&#xA;        if ((ret = av_read_frame(ifmt_ctx, dec_pkt)) &lt; 0)&#xA;            break;&#xA;&#xA;        if (video_stream == dec_pkt->stream_index)&#xA;            ret = dec_enc(dec_pkt, enc_codec, decoder_ctx);&#xA;&#xA;        av_packet_unref(dec_pkt);&#xA;    }&#xA;&#xA;    /* flush decoder */&#xA;    av_packet_unref(dec_pkt);&#xA;    ret = dec_enc(dec_pkt, enc_codec, decoder_ctx);&#xA;&#xA;    /* flush encoder */&#xA;    ret = encode_write(dec_pkt, NULL);&#xA;&#xA;    /* write the trailer for output stream */&#xA;    av_write_trailer(ofmt_ctx);&#xA;&#xA;end:&#xA;    avformat_close_input(&amp;ifmt_ctx);&#xA;    avformat_close_input(&amp;ofmt_ctx);&#xA;    avcodec_free_context(&amp;decoder_ctx);&#xA;    avcodec_free_context(&amp;encoder_ctx);&#xA;    av_buffer_unref(&amp;hw_device_ctx);&#xA;    av_packet_free(&amp;dec_pkt);&#xA;    return ret;&#xA;}&#xA;</output></encode></iostream>

    &#xA;

    And the content of the associated CMakeLists.txt file to build it using gcc :

    &#xA;

    cmake_minimum_required(VERSION 3.5)&#xA;&#xA;include(FetchContent)&#xA;&#xA;set(CMAKE_CXX_STANDARD 17)&#xA;set(CMAKE_CXX_STANDARD_REQUIRED ON)&#xA;&#xA;set(CMAKE_VERBOSE_MAKEFILE ON)&#xA;&#xA;SET (FFMPEG_HW_TRANSCODE_INCS&#xA;    ${CMAKE_CURRENT_LIST_DIR})&#xA;&#xA;include_directories(&#xA;    ${CMAKE_INCLUDE_PATH}&#xA;    ${CMAKE_CURRENT_LIST_DIR}&#xA;)&#xA;&#xA;project(FFmpeg_HW_transcode LANGUAGES CXX)&#xA;&#xA;set(CMAKE_CXX_FLAGS "-Wall -Werror=return-type -pedantic -fPIC -gdwarf-4")&#xA;set(CMAKE_CPP_FLAGS "-Wall -Werror=return-type -pedantic -fPIC -gdwarf-4")&#xA;&#xA;set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_LIST_DIR}/build/${CMAKE_BUILD_TYPE}/FFmpeg_HW_transcode")&#xA;set(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_LIST_DIR}/build/${CMAKE_BUILD_TYPE}/FFmpeg_HW_transcode")&#xA;&#xA;add_executable(${PROJECT_NAME})&#xA;&#xA;target_sources(${PROJECT_NAME} PRIVATE&#xA;                vaapi_transcode.cpp)&#xA;&#xA;target_link_libraries(${PROJECT_NAME}&#xA;                -L${CMAKE_CURRENT_LIST_DIR}/../build/${CMAKE_BUILD_TYPE}/FFmpeg_HW_transcode&#xA;                -lavdevice&#xA;                -lavformat&#xA;                -lavutil&#xA;                -lavcodec)&#xA;

    &#xA;

    Has anyone tried to do this kind of stuff ?

    &#xA;

    Thanks for your help.

    &#xA;

  • compiling ffmpeg_g.exe on mingw

    21 janvier 2014, par user3219986

    I have compiled ffmpeg from source using MSYS2 & MinGW. The library files : libavcodec.a, libavdvice.a libavfilter.a libavformat.a libavutila libpostproc.a libswresample.a libswscale.a were created successfully after running make and when it proceeds to build ffmpeg_g.exe I am getting lot of undefined references. Using -d option in make I found out that the command passed for building ffmpeg_g is :

    g++ -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,—nxcompat -Wl,—dynamicbase -Wl,—as-needed -Wl,—warn-common-Wl,-rpathlink=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -o ffmpeg_g.exe ffmpeg_opt.o ffmpeg_filter.o ffmpeg.o cmdutils.o -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswresample -lswscale -lavutil -lavicap32 -lpsapi -lole32 -lstrmiids -luuid -lws2_32 -lx264 -lvorbisenc -lvorbis -logg -lopenjpeg -lmp3lame -lbluray -L/mingw32/lib -lass -lm -lharfbuzz -lfontconfig -lexpat -lfreetype -lexpat -lenca -lm -lfribidi -lglib-2.0 -lintl -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -lfreetype -lz -lbz2 -lm -lbz2 -lz -lpsapi -ladvapi32 -lshell32

    The output is given below :

    ffmpeg_opt.o : In function

    new_output_stream&#39;:
    E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:1036: undefined reference to

    avcodec_get_context_defaults3'
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:1089 : undefined reference to

    av_get_exact_bits_per_sample&#39;
    ffmpeg_opt.o: In function

    find_codec_or_die' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:514 : undefined reference to

    avcodec_find_encoder_by_name&#39;
    ffmpeg_opt.o: In function

    choose_encoder' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:965 : undefined reference to

    avcodec_find_encoder&#39;
    ffmpeg_opt.o: In function

    find_codec_or_die' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:518 : undefined reference to

    avcodec_find_encoder&#39;
    E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:514: undefined reference to

    avcodec_find_decoder_by_name'
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:518 : undefined reference to

    avcodec_find_decoder&#39;
    ffmpeg_opt.o: In function

    add_input_streams' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:596 : undefined reference to

    av_codec_get_lowres&#39;
    ffmpeg_opt.o: In function

    choose_decoder' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:546 : undefined reference to

    avcodec_find_decoder&#39;
    ffmpeg_opt.o: In function

    add_input_streams' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:546 : undefined reference to

    avcodec_find_decoder&#39;
    ffmpeg_opt.o: In function

    open_input_file' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:872 : undefined reference to

    avcodec_get_class&#39;
    ffmpeg_opt.o: In function

    add_input_streams' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:631 : undefined reference to

    avcodec_find_decoder&#39;
    E:\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/ffmpeg_opt.c:595: undefined reference to

    avcodec_find_decoder'
    ........................ so many undefined references followed by :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/libavcodec/mlpdsp.c:64 : undefined reference to

    ff_mlpdsp_init_x86&#39;
    libavcodec/libavcodec.a(mpegaudiodsp.o): In function

    ff_mpadsp_init' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/libavcodec/mpegaudiodsp.c:46 : undefined reference to

    ff_mpadsp_init_x86&#39;
    libavcodec/libavcodec.a(cavsdsp.o): In function

    ff_cavsdsp_init' :
    E :\software\pkg\ffmpeg-2.1.3.tar\ffmpeg-2.1.3\ffmpeg-2.1.3/libavcodec/cavsdsp.c:565 : undefined reference to `ff_cavsdsp_init_x86'
    collect2.exe : error : ld returned 1 exit status

    LD ffmpeg_g.exe
    Reaping losing child 01584DA0 PID 29691080
    Makefile:105 : recipe for target 'ffmpeg_g.exe' failed
    Removing child 01584DA0 PID 29691080 from chain.

    Kindly tell me why the compilation fails.... Thanks in advance