Recherche avancée

Médias (91)

Autres articles (100)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (9316)

  • Privacy-enhancing technologies : Balancing data utility and security

    18 juillet, par Joe

    In the third quarter of 2024, data breaches exposed 422.61 million records, affecting millions of people around the world. This highlights the need for organisations to prioritise user privacy. 

    Privacy-enhancing technologies can help achieve this by protecting sensitive information and enabling safe data sharing. 

    This post explores privacy-enhancing technologies, including their types, benefits, and how our website analytics platform, Matomo, supports them by providing privacy-focused features.

    What are privacy-enhancing technologies ? 

    Privacy Enhancing Technologies (PETs) are tools that protect personal data while allowing organisations to process information responsibly. 

    In industries like healthcare, finance and marketing, businesses often need detailed analytics to improve operations and target audiences effectively. However, collecting and processing personal data can lead to privacy concerns, regulatory challenges, and reputational risks.

    PETs minimise the collection of sensitive information, enhance security and allow users to control how companies use their data. 

    Global privacy laws like the following are making PETs essential for compliance :

    Non-compliance can lead to severe penalties, including hefty fines and reputational damage. For example, under GDPR, organisations may face fines of up to €20 million or 4% of their global annual revenue for serious violations. 

    Types of PETs 

    What are the different types of technologies available for privacy protection ? Let’s take a look at some of them. 

    Homomorphic encryption

    Homomorphic encryption is a cryptographic technique in which users can perform calculations on cipher text without decrypting it first. When the results are decrypted, they match those of the same calculation on plain text. 

    This technique keeps data safe during processing, and users can analyse data without exposing private or personal data. It is most useful in financial services, where analysts need to protect sensitive customer data and secure transactions. 

    Despite these advantages, homomorphic encryption can be complex to compute and take longer than other traditional methods. 

    Secure Multi-Party Computation (SMPC)

    SMPC enables joint computations on private data without revealing the raw data. 

    In 2021, the European Data Protection Board (EDPB) issued technical guidance supporting SMPC as a technology that protects privacy requirements. This highlights the importance of SMPC in healthcare and cybersecurity, where data sharing is necessary but sensitive information must be kept safe. 

    For example, several hospitals can collaborate on research without sharing patient records. They use SMPC to analyse combined data while keeping individual records confidential. 

    Synthetic data

    Synthetic data is artificially generated to mimic real datasets without revealing actual information. It is useful for training models without compromising privacy. 

    Imagine a hospital wants to train an AI model to predict patient outcomes based on medical records. Sharing real patient data, however, poses privacy challenges, so that can be changed with synthetic data. 

    Synthetic data may fail to capture subtle nuances or anomalies in real-world datasets, leading to inaccuracies in AI model predictions.

    Pseudonymisation

    Pseudonymisation replaces personal details with fake names or codes, making it hard to determine who the information belongs to. This helps keep people’s personal information safe. Even if someone gets hold of the data, it’s not easy to connect it back to real individuals. 

    A visual representation of pseudonymisation

    Pseudonymisation works differently from synthetic data, though both help protect individual privacy. 

    When we pseudonymise, we take factual information and replace the bits that could identify someone with made-up labels. Synthetic data takes an entirely different approach. It creates new, artificial information that looks and behaves like real data but doesn’t contain any details about real people.

    Differential privacy

    Differential privacy adds random noise to datasets. This noise helps protect individual entries while still allowing for overall analysis of the data. 

    It’s useful in statistical studies where trends need to be understood without accessing personal details.

    For example, imagine a survey about how many hours people watch TV each week. 

    Differential privacy would add random variation to each person’s answer, so users couldn’t tell exactly how long John or Jane watched TV. 

    However, they could still see the average number of hours everyone in the group watched, which helps researchers understand viewing habits without invading anyone’s privacy.

    Zero-Knowledge Proofs (ZKP)

    Zero-knowledge proofs help verify the truth without exposing sensitive details. This cryptographic approach lets someone prove they know something or meet certain conditions without revealing the actual information behind that proof.

    Take ZCash as a real-world example. While Bitcoin publicly displays every financial transaction detail, ZCash offers privacy through specialised proofs called Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge (zk-SNARKs). These mathematical proofs confirm that a transaction follows all the rules without broadcasting who sent money, who received it, or how much changed hands.

    The technology comes with trade-offs, though. 

    Creating and checking these proofs demands substantial computing power, which slows down transactions and drives up costs. Implementing these systems requires deep expertise in advanced cryptography, which keeps many organisations from adopting them despite their benefits.

    Trusted Execution Environment (TEE)

    TEEs create special protected zones inside computer processors where sensitive code runs safely. These secure areas process valuable data while keeping it away from anyone who shouldn’t see it.

    TEEs are widely used in high-security applications, such as mobile payments, digital rights management (DRM), and cloud computing.

    Consider how companies use TEEs in the cloud : A business can run encrypted datasets within a protected area on Microsoft Azure or AWS Nitro Enclaves. Due to this setup, even the cloud provider can’t access the private data or see how the business uses it. 

    TEEs do face limitations. Their isolated design makes them struggle with large or spread-out computing tasks, so they don’t work well for complex calculations across multiple systems.

    Different TEE implementations often lack standardisation, so there can be compatibility issues and dependence on specific vendors. If the vendor stops the product or someone discovers a security flaw, switching to a new solution often proves expensive and complicated.

    Obfuscation (Data masking)

    Data masking involves replacing or obscuring sensitive data to prevent unauthorised access. 

    It replaces sensitive data with fictitious but realistic values. For example, a customer’s credit card number might be masked as “1234-XXXX-XXXX-5678.” 

    The original data is permanently altered or hidden, and the masked data can’t be reversed to reveal the original values.

    Federated learning

    Federated learning is a machine learning approach that trains algorithms across multiple devices without centralising the data. This method allows organisations to leverage insights from distributed data sources while maintaining user privacy.

    For example, NVIDIA’s Clara platform uses federated learning to train AI models for medical imaging (e.g., detecting tumours in MRI scans). 

    Hospitals worldwide contribute model updates from their local datasets to build a global model without sharing patient scans. This approach may be used to classify stroke types and improve cancer diagnosis accuracy.

    Now that we have explored the various types of PETs, it’s essential to understand the principles that guide their development and use. 

    Key principles of PET (+ How to enable them with Matomo) 

    PETs are based on several core principles that aim to balance data utility with privacy protection. These principles include :

    Data minimisation

    Data minimisation is a core PET principle focusing on collecting and retaining only essential data.

    Matomo, an open-source web analytics platform, helps organisations to gather insights about their website traffic and user behaviour while prioritising privacy and data protection. 

    Recognising the importance of data minimisation, Matomo offers several features that actively support this principle :

    Matomo can help anonymize IP addresses for data privacy

    (Image Source)

    7Assets, a fintech company, was using Google Analytics and Plausible as their web analytics tools. 

    However, with Google Analytics, they faced a problem of unnecessary data tracking, which created legal work overhead. Plausible didn’t have the features for the kind of analysis they wanted. 

    They switched to Matomo to enjoy the balance of privacy yet detailed analytics. With Matomo, they had full control over their data collection while also aligning with privacy and compliance requirements.

    Transparency and User Control

    Transparency and user control are important for trust and compliance. 

    Matomo enables these principles through :

    • Consent management : Offers integration with Consent Mangers (CMPs), like Cookiebot and Osano, for collecting and managing user consent.
    • Respect for DoNotTrack settings : Honours browser-based privacy preferences by default, empowering users with control over their data.
    With Matomo's DoNotTrack, organisations can give users an option to not get their details tracked

    (Image Source)

    • Opt-out mechanisms : These include iframe features that allow visitors to opt out of tracking

    Security and Confidentiality

    Security and confidentiality protect sensitive data against inappropriate access. 

    Matomo achieves this through :

    Purpose Limitation

    Purpose limitation means organisations use data solely for the intended purpose and don’t share or sell it to third parties. 

    Matomo adheres to this principle by using first-party cookies by default, so there’s no third-party involvement. Matomo offers 100% data ownership, meaning all the data organisations get from our web analytics is of the organisation, and we don’t sell it to any external parties. 

    Compliance with Privacy Regulations

    Matomo aligns with global privacy laws such as GDPRCCPAHIPAALGPD and PECR. Its compliance features include :

    • Configurable data protection : Matomo can be configured to avoid tracking personally identifiable information (PII).
    • Data subject request tools : These provide mechanisms for handling requests like data deletion or access in accordance with legal frameworks.
    • GDPR manager : Matomo provides a GDPR Manager that helps businesses manage compliance by offering features like visitor log deletion and audit trails to support accountability.
    GDPR manager by Matomo

    (Image Source)

    Mandarine Academy is a French-based e-learning company. It found that complying with GDPR regulations was difficult with Google Analytics and thought GA4 was hard to use. Therefore, it was searching for a web analytics solution that could help it get detailed feedback on its site’s strengths and friction points while respecting privacy and GDPR compliance. With Matomo, it checked all the boxes.

    Data collaboration : A key use case of PETs

    One specific area where PETs are quite useful is data collaboration. Data collaboration is important for organisations for research and innovation. However, data privacy is at stake. 

    This is where tools like data clean rooms and walled gardens play a significant role. These use one or more types of PETs (they aren’t PETs themselves) to allow for secure data analysis. 

    Walled gardens restrict data access but allow analysis within their platforms. Data clean rooms provide a secure space for data analysis without sharing raw data, often using PETs like encryption. 

    Tackling privacy issues with PETs 

    Amidst data breaches and privacy concerns, organisations must find ways to protect sensitive information while still getting useful insights from their data. Using PETs is a key step in solving these problems as they help protect data and build customer trust. 

    Tools like Matomo help organisations comply with privacy laws while keeping data secure. They also allow individuals to have more control over their personal information, which is why 1 million websites use Matomo.

    In addition to all the nice features, switching to Matomo is easy :

    “We just followed the help guides, and the setup was simple,” said Rob Jones. “When we needed help improving our reporting, the support team responded quickly and solved everything in one step.” 

    To experience Matomo, sign up for our 21-day free trial, no credit card details needed. 

  • Can not add tmcd stream using libavcodec to replicate behavior of ffmpeg -timecode option

    2 août, par Sailor Jerry

    I'm trying to replicate option of command line ffmpeg -timecode in my C/C++ code. For some reasons the tcmd stream is not written to the output file. However the av_dump_format shows it in run time

    


    Here is my minimal test

    


    #include <iostream>&#xA;extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>avutil.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include <libavutil></libavutil>samplefmt.h>&#xA;}&#xA;bool checkProResAvailability() {&#xA;  const AVCodec* codec = avcodec_find_encoder_by_name("prores_ks");&#xA;  if (!codec) {&#xA;    std::cerr &lt;&lt; "ProRes codec not available. Please install FFmpeg with ProRes support." &lt;&lt; std::endl;&#xA;    return false;&#xA;  }&#xA;  return true;&#xA;}&#xA;&#xA;int main(){&#xA;  av_log_set_level(AV_LOG_INFO);&#xA;&#xA;  const char* outputFileName = "test_tmcd.mov";&#xA;  AVFormatContext* formatContext = nullptr;&#xA;  AVCodecContext* videoCodecContext = nullptr;&#xA;&#xA;  if (!checkProResAvailability()) {&#xA;    return -1;&#xA;  }&#xA;&#xA;  std::cout &lt;&lt; "Creating test file with tmcd stream: " &lt;&lt; outputFileName &lt;&lt; std::endl;&#xA;&#xA;  // Allocate the output format context&#xA;  if (avformat_alloc_output_context2(&amp;formatContext, nullptr, "mov", outputFileName) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to allocate output context!" &lt;&lt; std::endl;&#xA;    return -1;&#xA;  }&#xA;&#xA;  if (avio_open(&amp;formatContext->pb, outputFileName, AVIO_FLAG_WRITE) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to open output file!" &lt;&lt; std::endl;&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  // Find ProRes encoder&#xA;  const AVCodec* videoCodec = avcodec_find_encoder_by_name("prores_ks");&#xA;  if (!videoCodec) {&#xA;    std::cerr &lt;&lt; "Failed to find the ProRes encoder!" &lt;&lt; std::endl;&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  // Video stream setup&#xA;  AVStream* videoStream = avformat_new_stream(formatContext, nullptr);&#xA;  if (!videoStream) {&#xA;    std::cerr &lt;&lt; "Failed to create video stream!" &lt;&lt; std::endl;&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  videoCodecContext = avcodec_alloc_context3(videoCodec);&#xA;  if (!videoCodecContext) {&#xA;    std::cerr &lt;&lt; "Failed to allocate video codec context!" &lt;&lt; std::endl;&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  videoCodecContext->width = 1920;&#xA;  videoCodecContext->height = 1080;&#xA;  videoCodecContext->pix_fmt = AV_PIX_FMT_YUV422P10;&#xA;  videoCodecContext->time_base = (AVRational){1, 30}; // Set FPS: 30&#xA;  videoCodecContext->bit_rate = 2000000;&#xA;&#xA;  if (avcodec_open2(videoCodecContext, videoCodec, nullptr) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to open ProRes codec!" &lt;&lt; std::endl;&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  if (avcodec_parameters_from_context(videoStream->codecpar, videoCodecContext) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to copy codec parameters to video stream!" &lt;&lt; std::endl;&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  videoStream->time_base = videoCodecContext->time_base;&#xA;&#xA;  // Timecode stream setup&#xA;  AVStream* timecodeStream = avformat_new_stream(formatContext, nullptr);&#xA;  if (!timecodeStream) {&#xA;    std::cerr &lt;&lt; "Failed to create timecode stream!" &lt;&lt; std::endl;&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  timecodeStream->codecpar->codec_type = AVMEDIA_TYPE_DATA;&#xA;  timecodeStream->codecpar->codec_id = AV_CODEC_ID_TIMED_ID3;&#xA;  timecodeStream->codecpar->codec_tag = MKTAG(&#x27;t&#x27;, &#x27;m&#x27;, &#x27;c&#x27;, &#x27;d&#x27;); // Timecode tag&#xA;  timecodeStream->time_base = (AVRational){1, 30}; // FPS: 30&#xA;&#xA;  if (av_dict_set(&amp;timecodeStream->metadata, "timecode", "00:00:30:00", 0) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to set timecode metadata!" &lt;&lt; std::endl;&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  // Write container header&#xA;  if (avformat_write_header(formatContext, nullptr) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to write file header!" &lt;&lt; std::endl;&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  // Encode a dummy video frame&#xA;  AVFrame* frame = av_frame_alloc();&#xA;  if (!frame) {&#xA;    std::cerr &lt;&lt; "Failed to allocate video frame!" &lt;&lt; std::endl;&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  frame->format = videoCodecContext->pix_fmt;&#xA;  frame->width = videoCodecContext->width;&#xA;  frame->height = videoCodecContext->height;&#xA;&#xA;  if (av_image_alloc(frame->data, frame->linesize, frame->width, frame->height, videoCodecContext->pix_fmt, 32) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to allocate frame buffer!" &lt;&lt; std::endl;&#xA;    av_frame_free(&amp;frame);&#xA;    avcodec_free_context(&amp;videoCodecContext);&#xA;    avio_close(formatContext->pb);&#xA;    avformat_free_context(formatContext);&#xA;    return -1;&#xA;  }&#xA;&#xA;  // Fill frame with black&#xA;  memset(frame->data[0], 0, frame->linesize[0] * frame->height); // Y plane&#xA;  memset(frame->data[1], 128, frame->linesize[1] * frame->height / 2); // U plane&#xA;  memset(frame->data[2], 128, frame->linesize[2] * frame->height / 2); // V plane&#xA;&#xA;  // Encode the frame&#xA;  AVPacket packet;&#xA;  av_init_packet(&amp;packet);&#xA;  packet.data = nullptr;&#xA;  packet.size = 0;&#xA;&#xA;  if (avcodec_send_frame(videoCodecContext, frame) == 0) {&#xA;    if (avcodec_receive_packet(videoCodecContext, &amp;packet) == 0) {&#xA;      packet.stream_index = videoStream->index;&#xA;      av_interleaved_write_frame(formatContext, &amp;packet);&#xA;      av_packet_unref(&amp;packet);&#xA;    }&#xA;  }&#xA;&#xA;  av_frame_free(&amp;frame);&#xA;&#xA;  // Write a dummy packet for the timecode stream&#xA;  AVPacket tmcdPacket;&#xA;  av_init_packet(&amp;tmcdPacket);&#xA;  tmcdPacket.stream_index = timecodeStream->index;&#xA;  tmcdPacket.flags |= AV_PKT_FLAG_KEY;&#xA;  tmcdPacket.data = nullptr; // Empty packet for timecode&#xA;  tmcdPacket.size = 0;&#xA;  tmcdPacket.pts = 0; // Set necessary PTS&#xA;  tmcdPacket.dts = 0;&#xA;  av_interleaved_write_frame(formatContext, &amp;tmcdPacket);&#xA;&#xA;  // Write trailer&#xA;  if (av_write_trailer(formatContext) &lt; 0) {&#xA;    std::cerr &lt;&lt; "Failed to write file trailer!" &lt;&lt; std::endl;&#xA;  }&#xA;&#xA;  av_dump_format(formatContext, 0, "test.mov", 1);&#xA;&#xA;  // Cleanup&#xA;  avcodec_free_context(&amp;videoCodecContext);&#xA;  avio_close(formatContext->pb);&#xA;  avformat_free_context(formatContext);&#xA;&#xA;  std::cout &lt;&lt; "Test file with timecode created successfully: " &lt;&lt; outputFileName &lt;&lt; std::endl;&#xA;&#xA;  return 0;&#xA;}&#xA;</iostream>

    &#xA;

    The code output is :

    &#xA;

    Creating test file with tmcd stream: test_tmcd.mov&#xA;[prores_ks @ 0x11ce05790] Autoselected HQ profile to keep best quality. It can be overridden through -profile option.&#xA;[mov @ 0x11ce04f20] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly&#xA;[mov @ 0x11ce04f20] Encoder did not produce proper pts, making some up.&#xA;Output #0, mov, to &#x27;test.mov&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf61.7.100&#xA;  Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le, 1920x1080, q=2-31, 2000 kb/s, 15360 tbn&#xA;  Stream #0:1: Data: timed_id3 (tmcd / 0x64636D74)&#xA;      Metadata:&#xA;        timecode        : 00:00:30:00&#xA;Test file with timecode created successfully: test_tmcd.mov&#xA;

    &#xA;

    The ffprobe output is :

    &#xA;

    $ ffprobe  test_tmcd.mov&#xA;ffprobe version 7.1.1 Copyright (c) 2007-2025 the FFmpeg developers&#xA;  built with Apple clang version 16.0.0 (clang-1600.0.26.6)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.1.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags=&#x27;-Wl,-ld_classic&#x27; --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon&#xA;  libavutil      59. 39.100 / 59. 39.100&#xA;  libavcodec     61. 19.101 / 61. 19.101&#xA;  libavformat    61.  7.100 / 61.  7.100&#xA;  libavdevice    61.  3.100 / 61.  3.100&#xA;  libavfilter    10.  4.100 / 10.  4.100&#xA;  libswscale      8.  3.100 /  8.  3.100&#xA;  libswresample   5.  3.100 /  5.  3.100&#xA;  libpostproc    58.  3.100 / 58.  3.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;test_tmcd.mov&#x27;:&#xA;  Metadata:&#xA;    major_brand     : qt  &#xA;    minor_version   : 512&#xA;    compatible_brands: qt  &#xA;    encoder         : Lavf61.7.100&#xA;  Duration: N/A, start: 0.000000, bitrate: N/A&#xA;  Stream #0:0[0x1]: Video: prores (HQ) (apch / 0x68637061), yuv422p10le, 1920x1080, 15360 tbn (default)&#xA;      Metadata:&#xA;        handler_name    : VideoHandler&#xA;        vendor_id       : FFMP&#xA;$ &#xA;&#xA;

    &#xA;

    Spent hours with all AI models, no help. Appeal to the human intelligence now

    &#xA;

  • NumPy array of a video changes from the original after writing into the same video

    29 mars 2021, par Rashiq

    I have a video (test.mkv) that I have converted into a 4D NumPy array - (frame, height, width, color_channel). I have even managed to convert that array back into the same video (test_2.mkv) without altering anything. However, after reading this new, test_2.mkv, back into a new NumPy array, the array of the first video is different from the second video's array i.e. their hashes don't match and the numpy.array_equal() function returns false. I have tried using both python-ffmpeg and scikit-video but cannot get the arrays to match.

    &#xA;

    Python-ffmpeg attempt :

    &#xA;

    import ffmpeg&#xA;import numpy as np&#xA;import hashlib&#xA;&#xA;file_name = &#x27;test.mkv&#x27;&#xA;&#xA;# Get video dimensions and framerate&#xA;probe = ffmpeg.probe(file_name)&#xA;video_stream = next((stream for stream in probe[&#x27;streams&#x27;] if stream[&#x27;codec_type&#x27;] == &#x27;video&#x27;), None)&#xA;width = int(video_stream[&#x27;width&#x27;])&#xA;height = int(video_stream[&#x27;height&#x27;])&#xA;frame_rate = video_stream[&#x27;avg_frame_rate&#x27;]&#xA;&#xA;# Read video into buffer&#xA;out, error = (&#xA;    ffmpeg&#xA;        .input(file_name, threads=120)&#xA;        .output("pipe:", format=&#x27;rawvideo&#x27;, pix_fmt=&#x27;rgb24&#x27;)&#xA;        .run(capture_stdout=True)&#xA;)&#xA;&#xA;# Convert video buffer to array&#xA;video = (&#xA;    np&#xA;        .frombuffer(out, np.uint8)&#xA;        .reshape([-1, height, width, 3])&#xA;)&#xA;&#xA;# Convert array to buffer&#xA;video_buffer = (&#xA;    np.ndarray&#xA;        .flatten(video)&#xA;        .tobytes()&#xA;)&#xA;&#xA;# Write buffer back into a video&#xA;process = (&#xA;    ffmpeg&#xA;        .input(&#x27;pipe:&#x27;, format=&#x27;rawvideo&#x27;, s=&#x27;{}x{}&#x27;.format(width, height))&#xA;        .output("test_2.mkv", r=frame_rate)&#xA;        .overwrite_output()&#xA;        .run_async(pipe_stdin=True)&#xA;)&#xA;process.communicate(input=video_buffer)&#xA;&#xA;# Read the newly written video&#xA;out_2, error = (&#xA;    ffmpeg&#xA;        .input("test_2.mkv", threads=40)&#xA;        .output("pipe:", format=&#x27;rawvideo&#x27;, pix_fmt=&#x27;rgb24&#x27;)&#xA;        .run(capture_stdout=True)&#xA;)&#xA;&#xA;# Convert new video into array&#xA;video_2 = (&#xA;    np&#xA;        .frombuffer(out_2, np.uint8)&#xA;        .reshape([-1, height, width, 3])&#xA;)&#xA;&#xA;# Video dimesions change&#xA;print(f&#x27;{video.shape} vs {video_2.shape}&#x27;) # (844, 1080, 608, 3) vs (2025, 1080, 608, 3)&#xA;print(f&#x27;{np.array_equal(video, video_2)}&#x27;) # False&#xA;&#xA;# Hashes don&#x27;t match&#xA;print(hashlib.sha256(bytes(video_2)).digest()) # b&#x27;\x88\x00\xc8\x0ed\x84!\x01\x9e\x08 \xd0U\x9a(\x02\x0b-\xeeA\xecU\xf7\xad0xa\x9e\\\xbck\xc3&#x27;&#xA;print(hashlib.sha256(bytes(video)).digest()) # b&#x27;\x9d\xc1\x07xh\x1b\x04I\xed\x906\xe57\xba\xf3\xf1k\x08\xfa\xf1\xfaM\x9a\xcf\xa9\t8\xf0\xc9\t\xa9\xb7&#x27;&#xA;

    &#xA;

    Scikit-video attempt :

    &#xA;

    import skvideo.io as sk&#xA;import numpy as np&#xA;&#xA;video_data = sk.vread(&#x27;test.mkv&#x27;)&#xA;&#xA;sk.vwrite(&#x27;test_2_ski.mkv&#x27;, video_data)&#xA;&#xA;video_data_2 = sk.vread(&#x27;test_2_ski.mkv&#x27;)&#xA;&#xA;# Dimensions match but...&#xA;print(video_data.shape) # (844, 1080, 608, 3)&#xA;print(video_data_2.shape) # (844, 1080, 608, 3)&#xA;&#xA;# ...array elements don&#x27;t&#xA;print(np.array_equal(video_data, video_data_2)) # False&#xA;&#xA;# Hashes don&#x27;t match either&#xA;print(hashlib.sha256(bytes(video_2)).digest()) # b&#x27;\x8b?]\x8epD:\xd9B\x14\xc7\xba\xect\x15G\xfaRP\xde\xad&amp;EC\x15\xc3\x07\n{a[\x80&#x27;&#xA;print(hashlib.sha256(bytes(video)).digest()) # b&#x27;\x9d\xc1\x07xh\x1b\x04I\xed\x906\xe57\xba\xf3\xf1k\x08\xfa\xf1\xfaM\x9a\xcf\xa9\t8\xf0\xc9\t\xa9\xb7&#x27;&#xA;

    &#xA;

    I don't understand where I'm going wrong and both the respective documentations do not highlight how to do this particular task. Any help is appreciated. Thank you.

    &#xA;