
Recherche avancée
Médias (1)
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (39)
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
HTML5 audio and video support
13 avril 2011, parMediaSPIP 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 (8033)
-
FFMPEG(?) Error : [out#0/s16le @ 000002452f906a00] Output file does not contain any stream
11 mars 2024, par OndoshFFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
 'options': '-vn'}
YDL_OPTIONS = {
 'format': 'bestaudio/best',
 'extractaudio': True,
 'noplaylist': True,
 'simulate': 'True',
 'preferredquality': '192',
 'preferredcodec': 'mp3',
 'key': 'FFmpegExtractAudio'}
@bot.command(aliases=['Ping', 'PING', 'Пинг', 'ПИНГ', 'зштп', 'ЗШТП', 'Зштп',
 'пинг'])
async def ping(ctx):
 await ctx.message.reply(f'Ping: {round(bot.latency * 1000)}ms')
#########################[PLAY MUSIC BLOCK]#########################
@bot.command()
async def add(ctx, *url):
 url = ' '.join(url)
 with yt_dlp.YoutubeDL(YDL_OPTIONS) as ydl:
 try:
 info = ydl.extract_info(url, download=False)
 except:
 info = ydl.extract_info(f"ytsearch:{url}",
 download=False)['entries'][0]

 URL = info['formats'][0]['url']
 name = info['title']
 time = str(datetime.timedelta(seconds=info['duration']))
 songs_queue.q_add([name, time, URL])
 embed = nextcord.Embed(description=f'Записываю [{name}]({url}) в очередь 📝',
 colour=nextcord.Colour.red())
 await ctx.message.reply(embed=embed)
def step_and_remove(voice_client):
 if loop_flag:
 songs_queue.q_add(songs_queue.get_value()[0])
 songs_queue.q_remove()
 audio_player_task(voice_client)
def audio_player_task(voice_client):
 if not voice_client.is_playing() and songs_queue.get_value():
 voice_client.play(nextcord.FFmpegPCMAudio(
 executable="ffmpeg\\bin\\ffmpeg.exe",
 source=songs_queue.get_value()[0][2],
 **FFMPEG_OPTIONS),
 after=lambda e: step_and_remove(voice_client))
@bot.command(aliases=['Play', 'PLAY', 'играй', 'ИГРАЙ', 'Играй', 'сыграй',
 'Сыграй', 'СЫГРАЙ', 'здфн', 'Здфн', 'ЗДФН', 'p', 'P',
 'pl', 'PL', 'Pl', 'Плей',
 'ПЛЕЙ', 'плей'])
async def play(ctx, *url):
 await join(ctx)
 await add(ctx, ' '.join(url))
 await ctx.message.add_reaction(emoji='🎸')
 voice_client = ctx.guild.voice_client
 audio_player_task(voice_client)
@bot.command(aliases=['Queue', 'QUEUE', 'йгугу', 'Йгугу', 'ЙГУГУ', 'очередь',
 'Очередь', 'ОЧЕРЕДЬ', 'список', 'Список', 'СПИСОК',
 'list', 'List', 'LIST', 'дшые', 'Дшые', 'ДШЫЕ', 'Лист',
 'лист', 'ЛИСТ', 'песни', 'Песни', 'ПЕСНИ', 'songs',
 'Songs', 'SONGS', 'ыщтпы', 'ЫЩТПЫ', 'Ыщтпы', 'q'])
async def queue(ctx):
 if len(songs_queue.get_value()) > 0:
 only_names_and_time_queue = []
 for i in songs_queue.get_value():
 name = i[0]
 if len(i[0]) > 30:
 name = i[0][:30] + '...'
 only_names_and_time_queue.append(f'📀 `{name:<33} {i[1]:>20}`\n')
 c = 0
 queue_of_queues = []
 while c < len(only_names_and_time_queue):
 queue_of_queues.append(only_names_and_time_queue[c:c + 10])
 c += 10

 embed = nextcord.Embed(title=f'ОЧЕРЕДЬ [LOOP: {loop_flag}]',
 description=''.join(queue_of_queues[0]),
 colour=nextcord.Colour.red())
 await ctx.send(embed=embed)

 for i in range(1, len(queue_of_queues)):
 embed = nextcord.Embed(description=''.join(queue_of_queues[i]),
 colour=nextcord.Colour.red())
 await ctx.send(embed=embed)
 else:
 await ctx.send('Очередь пуста')



There is the part of my music bot in Discord, I don't really know why it doesn't work. Actually, I tried to use someone's old code, so it needs to be fixed. I have cut out the most important parts of the code, which most likely had an error.
I found other questions, but there was another errors.
After trying to start the video, I get the following errors :
[out#0/s16le @ 000002452f906a00] Output file does not contain any stream
Error opening output file pipe:1.
Error opening output files : Invalid argument


-
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();
})();