
Recherche avancée
Autres articles (59)
-
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (7604)
-
FFMpeg and WebM/VP8
25 novembre 2011, par Anand SureshI am trying to use ffmpeg and ffserver to stream VP8 video.
I am using the following command to start FFMpeg :
ffmpeg -v 9 -loglevel 99 -f x11grab -s 1440x900 -r2 -i :0.0 -f webm http://localhost:8090/feed1.ffm
The above command abruptly terminates generating the following error :
> FFmpeg version 0.6.2-4:0.6.2-1ubuntu1.1, Copyright (c) 2000-2010 the Libav developers
built on Sep 16 2011 16:57:46 with gcc 4.5.2
configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
libavutil configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libavcodec configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libavformat configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libavdevice configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libavfilter configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libswscale configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libpostproc configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[x11grab @ 0x9869420]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1440 height: 900
[x11grab @ 0x9869420]shared memory extension found
[x11grab @ 0x9869420]Probe buffer size limit 5000000 reached
[x11grab @ 0x9869420]Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1322253753.374957, bitrate: 41472 kb/s
Stream #0.0, 1, 1/1000000: Video: rawvideo, bgra, 1440x900, 1/1, 41472 kb/s, 1 tbr, 1000k tbn, 1 tbc
[libvpx @ 0x9876540]v0.9.6
[libvpx @ 0x9876540]--enable-pic --enable-shared --disable-install-bins --disable-install-srcs --target=x86-linux-gcc
[libvpx @ 0x9876540]vpx_codec_enc_cfg
[libvpx @ 0x9876540]generic settings
g_usage: 0
g_threads: 0
g_profile: 0
g_w: 320
g_h: 240
g_timebase: {1/30}
g_error_resilient: 0
g_pass: 0
g_lag_in_frames: 0
[libvpx @ 0x9876540]rate control settings
rc_dropframe_thresh: 0
rc_resize_allowed: 0
rc_resize_up_thresh: 60
rc_resize_down_thresh: 30
rc_end_usage: 0
rc_twopass_stats_in: (nil)(0)
rc_target_bitrate: 256
[libvpx @ 0x9876540]quantizer settings
rc_min_quantizer: 4
rc_max_quantizer: 63
[libvpx @ 0x9876540]bitrate tolerance
rc_undershoot_pct: 95
rc_overshoot_pct: 200
[libvpx @ 0x9876540]decoder buffer model
rc_buf_sz: 6000
rc_buf_initial_sz: 4000
rc_buf_optimal_sz: 5000
[libvpx @ 0x9876540]2 pass rate control settings
rc_2pass_vbr_bias_pct: 50
rc_2pass_vbr_minsection_pct: 0
rc_2pass_vbr_maxsection_pct: 400
[libvpx @ 0x9876540]keyframing settings
kf_mode: 1
kf_min_dist: 0
kf_max_dist: 9999
[libvpx @ 0x9876540]
[libvpx @ 0x9876540]vpx_codec_enc_cfg
[libvpx @ 0x9876540]generic settings
g_usage: 0
g_threads: 1
g_profile: 0
g_w: 1440
g_h: 900
g_timebase: {1/1}
g_error_resilient: 0
g_pass: 0
g_lag_in_frames: 0
[libvpx @ 0x9876540]rate control settings
rc_dropframe_thresh: 0
rc_resize_allowed: 0
rc_resize_up_thresh: 60
rc_resize_down_thresh: 30
rc_end_usage: 0
rc_twopass_stats_in: (nil)(0)
rc_target_bitrate: 200
[libvpx @ 0x9876540]quantizer settings
rc_min_quantizer: 1
rc_max_quantizer: 38
[libvpx @ 0x9876540]bitrate tolerance
rc_undershoot_pct: 95
rc_overshoot_pct: 200
[libvpx @ 0x9876540]decoder buffer model
rc_buf_sz: 6000
rc_buf_initial_sz: 4000
rc_buf_optimal_sz: 5000
[libvpx @ 0x9876540]2 pass rate control settings
rc_2pass_vbr_bias_pct: 50
rc_2pass_vbr_minsection_pct: 0
rc_2pass_vbr_maxsection_pct: 400
[libvpx @ 0x9876540]keyframing settings
kf_mode: 1
kf_min_dist: 0
kf_max_dist: 12
[libvpx @ 0x9876540]
[libvpx @ 0x9876540]vpx_codec_control
[libvpx @ 0x9876540] VP8E_SET_CPUUSED: 3
[libvpx @ 0x9876540] VP8E_SET_NOISE_SENSITIVITY: 0
Output #0, webm, to 'http://127.0.0.1:8090/feed1.ffm':
Metadata:
encoder : Lavf52.64.2
Stream #0.0, 0, 1/1000: Video: libvpx, yuv420p, 1440x900, 1/1, q=2-31, 200 kb/s, 1k tbn, 1 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
[webm @ 0x98753b0]Writing block at offset 15, size 158658, pts 0, dts 0, duration 1000, flags 128
[webm @ 0x98753b0]Starting new cluster at offset 158681 bytes, pts 0Can anyone point out what I am doing wrong here ? Why does ffmpeg die everytime it starts a new cluster ?
Thanks
-
Can't view and record graph at the same time using FFMpegWriter [closed]
7 juillet 2024, par Barkın ÖzerSo 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.


-
Issue with streaming in realtime to HTML5 video player
24 juillet 2023, par ImaSquareBTWok so i created a project which should take an mkv file convert it to a sutaible fomrat in relatime and play it as it transcodes in the html 5 video player and should play as soon as small segement is ready for playback but unfornatlly it does seem to work heres my code if your curious, help would be very much appreicted




 
 
 
 
 <video controls="controls">
 <source src="output.mp4" type="video/mp4">
 </source></video>
 <code class="echappe-js"><script src="https://cdnjs.cloudflare.com/ajax/libs/ffmpeg/0.11.6/ffmpeg.min.js" integrity="sha512-91IRkhfv1tLVYAdH5KTV&#x2B;KntIZP/7VzQ9E/qbihXFSj0igeacWWB7bQrdiuaJVMXlCVREL4Z5r&#x2B;3C4yagAlwEw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script src='http://stackoverflow.com/feeds/tag/player.js'></script>

 



and my javscript :


let mediaSource;
let sourceBuffer;
let isTranscoding = false;
let bufferedSeconds = 0;

async function setupMediaSource() {
 mediaSource = new MediaSource();
 const videoPlayer = document.getElementById('video-player');
 videoPlayer.src = URL.createObjectURL(mediaSource);
 await new Promise(resolve => {
 mediaSource.addEventListener('sourceopen', () => {
 sourceBuffer = mediaSource.addSourceBuffer('video/mp4; codecs="avc1.64001E, mp4a.40.2"'); // Match the transcoded format
 sourceBuffer.addEventListener('updateend', () => {
 if (!sourceBuffer.updating && mediaSource.readyState === 'open') {
 mediaSource.endOfStream();
 resolve();
 }
 });
 });
 });
}

async function transcodeVideo() {
 const ffmpeg = createFFmpeg({ log: true });
 const videoPlayer = document.getElementById('video-player');

 await ffmpeg.load();
 const transcodeCommand = ['-i', 'The Legend of Old Gregg S02E05.mkv', '-c:v', 'libx264', '-preset', 'ultrafast', '-c:a', 'aac', '-strict', 'experimental', '-f', 'mp4', '-movflags', 'frag_keyframe+empty_moov', 'output.mp4'];

 const videoUrl = 'The Legend of Old Gregg S02E05.mkv'; // The URL of the original video file

 let lastBufferedSeconds = 0;
 let currentTime = 0;
 while (currentTime < videoPlayer.duration) {
 if (!isTranscoding && sourceBuffer.buffered.length > 0 && sourceBuffer.buffered.end(0) - currentTime < 5) {
 isTranscoding = true;
 const start = sourceBuffer.buffered.end(0);
 const end = Math.min(videoPlayer.duration, start + 10);
 await fetchAndTranscode(videoUrl, start, end, ffmpeg, transcodeCommand);
 isTranscoding = false;
 currentTime = end;
 bufferedSeconds += (end - start);
 const transcodingSpeed = bufferedSeconds / (currentTime);
 lastBufferedSeconds = bufferedSeconds;
 console.log(`Transcoded ${end - start} seconds of video. Buffered: ${bufferedSeconds.toFixed(2)}s (${transcodingSpeed.toFixed(2)}x speed)`);
 }
 await new Promise(resolve => setTimeout(resolve, 500));
 }

 await ffmpeg.exit();
}

async function fetchAndTranscode(url, start, end, ffmpeg, transcodeCommand) {
 const response = await fetch(url, { headers: { Range: `bytes=${start}-${end}` } });
 const data = new Uint8Array(await response.arrayBuffer());
 ffmpeg.FS('writeFile', 'input.mkv', data); // Use 'input.mkv' as a temporary file
 await ffmpeg.run(...transcodeCommand);
 const outputData = ffmpeg.FS('readFile', 'output.mp4');
 appendSegmentToBuffer(outputData);
}

function appendSegmentToBuffer(segment) {
 if (!sourceBuffer.updating) {
 sourceBuffer.appendBuffer(segment);
 } else {
 sourceBuffer.addEventListener('updateend', () => {
 sourceBuffer.appendBuffer(segment);
 });
 }
}

async function createFFmpeg(options) {
 const { createFFmpeg } = FFmpeg;
 const ffmpeg = createFFmpeg(options);
 await ffmpeg.load();
 return ffmpeg;
}

(async () => {
 await setupMediaSource();
 await transcodeVideo();
})();