
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (68)
-
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...) -
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (8387)
-
Can't correctly decode an image frame using OpenCV
15 avril 2023, par Martin BloreI'm trying to simply encode and decode a capture frame from the web-cam. I want to be able to send this over TCP but at the moment I'm having trouble performing this just locally.


Here's my code that simply takes the frame from the web-cam, encodes, then decodes, and displays the two images in a new window. The two images look like this :


https://i.imgur.com/dGSlmrH.png


Here's the code :


import struct
import cv2
import socket
import av
import time
import os

class PerfTimer:
 def __init__(self, name):
 self.name = name

 def __enter__(self):
 self.start_time = time.perf_counter()

 def __exit__(self, type, value, traceback):
 end_time = time.perf_counter()
 print(f"'{self.name}' taken:", end_time - self.start_time, "seconds.")

os.environ['AV_PYTHON_AVISYNTH'] = 'C:/ffmpeg/bin'

socket_enabled = False
sock = None
if socket_enabled:
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 print("Connecting to server...")
 sock.connect(('127.0.0.1', 8000))

# Set up video capture.
print("Opening web cam...")
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 800)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 600)

# Initialize the encoder.
encoder = av.CodecContext.create('h264', 'w')
encoder.width = 800
encoder.height = 600
encoder.pix_fmt = 'yuv420p'
encoder.bit_rate = 5000

# Initialize the decoder.
decoder = av.CodecContext.create('h264', 'r')
decoder.width = 800
decoder.height = 600
decoder.pix_fmt = 'yuv420p'
decoder.bit_rate = 5000

print("Streaming...")
while(cap.isOpened()):
 
 # Capture the frame from the camera.
 ret, orig_frame = cap.read()

 cv2.imshow('Source Video', orig_frame)

 # Convert to YUV.
 img_yuv = cv2.cvtColor(orig_frame, cv2.COLOR_BGR2YUV_I420)

 # Create a video frame object from the num py array.
 video_frame = av.VideoFrame.from_ndarray(img_yuv, format='yuv420p')

 with PerfTimer("Encoding") as p:
 encoded_frames = encoder.encode(video_frame)

 # Sometimes the encode results in no frames encoded, so lets skip the frame.
 if len(encoded_frames) == 0:
 continue

 print(f"Decoding {len(encoded_frames)} frames...")

 for frame in encoded_frames:
 encoded_frame_bytes = bytes(frame)

 if socket_enabled:
 # Get the size of the encoded frame in bytes
 size = struct.pack('code>


-
How to Concatenate bunch of videos using python ?
5 juillet 2023, par Saikat ChakrabortySo, I have over 5000 small clips that I need to combine. To apply various custom filter over their names, I want to do it with python. I have the following code :


import os
from moviepy.editor import *
os.chdir('D:/videos')
list1, list2 = os.listdir(), []

for i in list1: #filtering
 if i[-6:] != '-l.mp4' and i[-7:] != 'ALT.mp4':
 list2.append(i)
print('Getting Video Info:')

final = VideoFileClip(list2[0])


for i in range(1,len(list2)):
 final = concatenate_videoclips([final, VideoFileClip(list2[i])])
 print('\r' + str(i+1) + '/' + str(len(list2)), end='')


os.chdir('D:')
final.write_videofile('Merged.mp4')



But the program is creating lots of processes and just after reading 150 clips it's crashing.


It keeps increasing !
Is there any easier way/alternative to do this ? Thanks !


Edit :

I've tried using ffmpeg too, but concatenation removes the audio since concat protocol doesn't support .mp4 extension. In that case. Even if I convert all the files to .ts extension and try to concatenate them,WindowsError: [Error 206] The filename or extension is too long
pops up because too many files are separated by |. I did the following changes after converting all the files to .ts format :

import os
import ffmpeg
os.chdir('D:/videos')
list1 = os.listdir()
list2 = [i for i in list1 if i[-3:] == '.ts']
list2[0] = ffmpeg.input(list2[0])
for i in range(1, len(list2)):
 list2[i] = ffmpeg.concat(list2[i-1], ffmpeg.input(list2[i]))
 print('\r' + str(i) + '/' + str(len(list2)), end='')
ffmpeg.output(list2[-1], 'D:\Merged.mp4')
ffmpeg.run(list2[-1])



But now I'm getting
RecursionError: maximum recursion depth exceeded while calling a Python object
.

-
How can I add a random watermark to a video during processing in Node.js and Express.js using FFmpeg ?
3 avril 2023, par Ariful islamI want to add a watermark to a video that changes randomly during processing. I am using Node.js and Express.js with FFmpeg. Currently, I am able to add a static watermark to the video using the drawtext filter. However, I want to change the watermark text randomly every few seconds.


How can I achieve this using FFmpeg in my Node.js and Express.js app ? Here's my current code :


const email = 'name@gmail.com';
app.post('/addwatermark', upload.single('video'), (req, res) => {
const fileName = path.basename(req.file.path) + '.mp4';
const outputPath = `public/reduceSize/${fileName}`;
const outputPathWithWatermark = `public/reduceSize/${fileName}-wm.mp4`;
let watermarkPosition = { x: 10, y: 650 };

// Create the directory if it doesn't exist
const outputDir = path.dirname(outputPathWithWatermark);
if (!fs.existsSync(outputDir)) {
 fs.mkdirSync(outputDir, { recursive: true });
}

// Send a comment to keep the connection alive
res.write(': ping\n\n');

// Function to randomly generate watermark position
const changeWatermarkPosition = () => {
 watermarkPosition = { x: Math.floor(Math.random() * 100), y: Math.floor(Math.random() * 100) };
};

// Change watermark position every 5 seconds 
setInterval(changeWatermarkPosition, 5000);
const watermarkStyle = `-vf drawtext=text='${email}':x=(w-text_w-10):y=(h-text_h-10):fontcolor=white:fontsize=24:shadowcolor=black:shadowx=1:shadowy=1:box=1:y=${watermarkPosition.y}:fontcolor=red:fontsize=24:shadowcolor=black:shadowx=1:shadowy=1:box=1:boxcolor=black@0.5`

ffmpeg(req.file.path)
 .addOption(watermarkStyle)
 .output(outputPathWithWatermark)
 .videoCodec('libx264')
 .audioCodec('aac')
 .size('50%')
 .on('error', (err) => {
 console.error(`FFmpeg error: ${err.message}`);
 res.status(500).json({ message: err.message });
 })
 .on('progress', (progress) => {
 // Set the watermark position every 5 seconds randomly
 changeWatermarkPosition();

 const mb = progress.targetSize / 1024;
 const data = {
 message: `Processing: ${mb.toFixed(2)} MB converted`,
 watermark: `Adding watermark to video: ${progress.framesProcessed} frames processed`
 };
 console.log(data.message);
 res.write(`data: ${JSON.stringify(data)}\n\n`);

 })
 .on('end', () => {
 console.log(`Video successfully converted to ${outputPathWithWatermark}`);
 // Remove the temporary file
 })
 .run();
 });



I want to secure my video from unauthorized person by using email in a video and the email will be move around the video randomly every 5 seconds.


I have read this (Add dynamic watermark that randomly changes position over video React/Node) document but didn't get any solution.