Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (30)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

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

Sur d’autres sites (3656)

  • Decoding the h.264 stream from a COM port

    18 mars, par Peter

    I would like to know if there is a reliable way to decode an H.264 NAL stream coming through a serial port using software.

    


    So far, I have managed to decode a single frame using a python script. In this script, I first write the incoming data to a file, and when the end-of-frame marker 00_00_00_01 appears, I display the frame using ffplay.

    


    import serial
import subprocess
import os
import time

ser = serial.Serial('COM3', 115200, timeout=1)
output_file = "output.264"

# Variable to store the ffplay process
ffplay_process = None

# Open the file for writing in binary mode
with open(output_file, "wb") as file:

    print("Writing bytes to output.264. Waiting for the end-of-frame marker 0x00000001.")

    buffer = bytearray()
    marker = b'\x00\x00\x00\x01'

    try:
        while True:
            if ser.in_waiting:  # If there is data in the buffer
                data = ser.read(ser.in_waiting)  # Read all available bytes
                buffer.extend(data)

                # Check if the end-of-frame marker is in the buffer
                while marker in buffer:
                    index = buffer.index(marker) + len(marker)  # Position after the marker
                    frame = buffer[:index]  # Extract the frame
                    buffer = buffer[index:]  # Keep the remaining data

                    print(f"Frame recorded: {len(frame)} bytes")
                    file.write(frame)  # Write the frame to the file
                    file.flush()  # Force writing to disk

                    # Close the ffplay window if it is already open
                    if ffplay_process and ffplay_process.poll() is None:
                        ffplay_process.terminate()
                        ffplay_process.wait()  # Wait for the process to terminate

                    # Play the recorded frame, reopening the window
                    ffplay_process = subprocess.Popen(["ffplay", "-f", "h264", "-i", output_file])

    except KeyboardInterrupt:
        print("\nRecording stopped.")
    finally:
        # Close the serial port and the ffplay process
        ser.close()


    


    However, each time a new end-of-frame marker is detected, the ffplay window closes and reopens to show the next frame. It will flicker when transferring the video. Is there a way to display the frames in the same window for seamless playback when streaming video ?

    


    Or is there a better approach or software that is more suited for this task ? I do not know where to start, so I will be glad for any hints.

    


  • Can't view and record graph at the same time using FFMpegWriter [closed]

    7 juillet 2024, par Barkın Özer

    So this code is used for graphing and logging sensor data coming from bluetooth ports. I wanted to add an function that will record the graph in mp4 format. In order to achieve this I used ffmpegWriter. The issue is while this code records the graph I can't view the graph at the same time.

    


    import serial
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, FFMpegWriter
import openpyxl
from datetime import datetime

# Constants
GRAVITY = 9.81  # Standard gravity in m/s²

# Initialize serial connections to HC-06 devices
ser_x_accel = serial.Serial('COM4', 9600, timeout=1)  # X-axis acceleration data
ser_y_angle = serial.Serial('COM11', 9600, timeout=1)  # Y-axis angle data

# Initialize empty lists to store data
x_accel_data = []
y_angle_data = []
timestamps = []

# Initialize Excel workbook
wb = openpyxl.Workbook()
ws = wb.active
ws.title = "Sensor Data"
ws.append(["Timestamp", "X Acceleration (m/s²)", "Y Angle (degrees)"])

# Function to update the plot and log data
def update(frame):
    # Read data from serial connections
    line_x_accel = ser_x_accel.readline().decode('utf-8').strip()
    line_y_angle = ser_y_angle.readline().decode('utf-8').strip()
    
    try:
        # Parse and process X-axis acceleration data
        x_accel_g = float(line_x_accel)  # Acceleration in g read from serial
        x_accel_ms2 = x_accel_g * GRAVITY  # Convert from g to m/s²
        x_accel_data.append(x_accel_ms2)
        
        # Parse and process Y-axis angle data
        y_angle = float(line_y_angle)
        y_angle_data.append(y_angle)
        
        # Append timestamp
        timestamps.append(datetime.now())

        # Limit data points to show only the latest 100
        if len(x_accel_data) > 100:
            x_accel_data.pop(0)
            y_angle_data.pop(0)
            timestamps.pop(0)

        # Log data to Excel with timestamp
        timestamp_str = timestamps[-1].strftime("%H:%M:%S")
        ws.append([timestamp_str, x_accel_data[-1], y_angle_data[-1]])

        # Clear and update plots
        ax1.clear()
        ax1.plot(timestamps, x_accel_data, label='X Acceleration', color='b')
        ax1.legend(loc='upper left')
        ax1.set_ylim([-20, 20])  # Adjust based on expected acceleration range in m/s²
        ax1.set_title('Real-time X Acceleration Data')
        ax1.set_xlabel('Time')
        ax1.set_ylabel('Acceleration (m/s²)')
        ax1.grid(True)

        ax2.clear()
        ax2.plot(timestamps, y_angle_data, label='Y Angle', color='g')
        ax2.legend(loc='upper left')
        ax2.set_ylim([-180, 180])
        ax2.set_title('Real-time Y Angle Data')
        ax2.set_xlabel('Time')
        ax2.set_ylabel('Angle (degrees)')
        ax2.grid(True)

        # Update text boxes with latest values
        text_box.set_text(f'X Acceleration: {x_accel_data[-1]:.2f} m/s²')
        text_box2.set_text(f'Y Angle: {y_angle_data[-1]:.2f}°')
        
        # Save the workbook periodically (every 100 updates)
        if frame % 100 == 0:
            wb.save("sensor_data.xlsx")
        
    except ValueError:
        pass  # Ignore lines that are not properly formatted

# Setup the plots
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 8))
text_box = ax1.text(0.05, 0.95, '', transform=ax1.transAxes, fontsize=12, verticalalignment='top', bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.5))
text_box2 = ax2.text(0.05, 0.95, '', transform=ax2.transAxes, fontsize=12, verticalalignment='top', bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.5))

# Animate the plots
ani = FuncAnimation(fig, update, interval=100)  # Update interval of 100ms

# Save the animation as a video file
writer = FFMpegWriter(fps=10, metadata=dict(artist='Me'), bitrate=1800)
ani.save("sensor_data.mp4", writer=writer)

plt.tight_layout()
plt.show()

# Save the workbook at the end of the session
wb.save("sensor_data.xlsx")



    


    I tried using OpenCV to record the graph but then I didn't even got any recording. I think solving this issue with my original code would be a better approach.

    


  • How the ffmpeg is fixing Handle page termination with same page number ...? [closed]

    11 avril 2024, par adarsh

    Im working on the teletext subtitle feature and faced with subs not clearing issue.
the subtitle lines remain displayed until being replaced by a new version of the specific line. So the subtitles never disappear and often an old line is still displayed, after another, more recent line is displayed/updated.
take a look at the issue in this sample video file : https://code.videolan.org/videolan/vlc/uploads/58c2e1660e94e2df5e8cdb75edf531d9/GODFATHER__03_.ts
Issue reported : https://sourceforge.net/p/zapping/bugs/203/

    


    The player is using ffmpeg and libzvbi library.

    


    At first I suspected that the Erase Page Flag (C4) in the Page Header was not set, but the flag was indeed set (at least once between two LOPs with subtitles). After further debugging it turned out that the Teletext service in the two issues consists of just a single Teletext page - which is the reason here :

    


    The Teletext spec defines the Magazine Serial Flag (C11) in Table 2 (ETSI EN 300 706 v1.2.1) as (bold font by me) :

    


    When set to '1' the service is designated to be in Serial mode and the transmission of a page is terminated by the next page header with a different page number.
When set to '0' the service is designated to be in Parallel mode and the transmission of a page is terminated by the next page header with a different page number but the same magazine number.
The same setting shall be used for all page headers in the service.
(BTW it doesn't really matter, but in these two cases this flag is always 0)

    


    In vbi_decode_teletext in /src/packet.c, storing the page is aborted, if the condition "page terminated" in the C11 definition is not met. But as the service here consists of only one page, this condition is never met !

    


    Luckily, this issue was fixed in ffmpeg- https://github.com/FFmpeg/FFmpeg/commit/b1e0e216462a989a39e7b413aef6d32f8cedc154

    


    and also in zvbi :
https://github.com/zapping-vbi/zvbi/commit/40a6ab0200c46b67b059b5b1fb15793ce780892a

    


    I understand the root cause and fix in zvbi library, and how it is ignoring c4 flag in case the same page no.

    


    But i want to understand how the ffmpeg fix is working ?
ffmpeg fix : https://github.com/FFmpeg/FFmpeg/commit/b1e0e216462a989a39e7b413aef6d32f8cedc154

    


    what is the rule for repeated page headers ?