Recherche avancée

Médias (91)

Autres articles (101)

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

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (6721)

  • Popcorn Hour revisited

    26 février 2015, par Mans — Hardware

    In a previous post, I recounted my adventures with the Popcorn Hour C-200 media player. Having not given the device much thought since then, I recently decided to dust it off and see what it was really made of. This is what I found. Components The system is based on … Continue reading

  • One way only video stream for half duplex communication

    15 décembre 2022, par Ri Di

    I am testing two half duplex radios, so there can only be one way communication. I want to stream video, so I thought using UDP, because it does not require handshake. Does gstreamer, for example, have such feature ? I know it has UDP, but as I understand, it still requires requests sent back to start streaming. How could I stream my webcamera video directly to some IP via UDP only ?

    


  • How to correctly encrypt the I-frames in video files ?

    25 mai 2023, par Bob

    I'm trying to encrypt only the I-frames of a video file so that the energy overhead is lessened compared to if I tried to encrypt the whole file. However, after encrypting what I thought were the I-frames, the video seems to play normally (except for the encrypted frames). I thought that the point of encrypting the I-frames was so that the other frames would be distorted, but that doesn't seem to be the case. I was wondering what seems to be wrong ? The file format is avi with codec MPEG-4 video (FMP4).

    


    I used ffmpeg to identity the I frames of a certain video (named "video1") : "ffprobe -select_streams v -show_frames -of csv video1.avi > video_frame_info.csv". I got this table which seems to indicate that every 12th frame is an I-frame. I then used this python program to encrypt every 12th frame with chacha20 from the pycryptodome library :

    


    from Crypto.Cipher import ChaCha20
from Crypto.Random import get_random_bytes
import cv2
import numpy as np

def read_frames(video_path):
    # Load the video file
    video = cv2.VideoCapture(video_path)

    # Initialize a list to hold frames
    frames = []

    # Loop until there are frames left in the video file
    while video.isOpened():
        ret, frame = video.read()
        if not ret:
            break

        frames.append(frame)

    video.release()

    return frames

def encrypt_iframes(frames, key):
    # Initialize the cipher
    cipher = ChaCha20.new(key=key)

    # Encrypt every 12th frame (considering the first frame as an I-frame)
    for i in range(0, len(frames), 12):
        frame = frames[i]
        # Flatten and bytes-encode the frame
        flat_frame = frame.flatten()
        bytes_frame = flat_frame.tobytes()

        # Encrypt the frame
        encrypted_frame = cipher.encrypt(bytes_frame)

        # Replace the original frame with the encrypted one
        frames[i] = np.frombuffer(encrypted_frame, dtype=flat_frame.dtype).reshape(frame.shape)

    return frames

def write_frames(frames, output_path):
    # Assume all frames have the same shape
    height, width, _ = frames[0].shape

    # Create a VideoWriter object
    out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*'mpv4'), 30, (width, height))

    for frame in frames:
        out.write(frame)

    out.release()

def main():
    # Generate a random key
    key = get_random_bytes(32)

    # Read frames from video
    frames = read_frames('video1.avi')

    # Encrypt I-frames
    encrypted_frames = encrypt_iframes(frames, key)

    # Write encrypted frames to a new video file
    write_frames(encrypted_frames, 'reprise.avi')

if __name__ == "__main__":
    main()



    


    When I play the video, every 12th frame there is just noise on the screen, which makes sense since it was encrypted. However, all the other frames seem to be completely normal, even thought they are P-frames and should depend on the I-frames. What am I doing wrong, and how can I make it so that it works as intended ?
Thanks in advance