
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (82)
-
Soumettre bugs et patchs
10 avril 2011Un logiciel n’est malheureusement jamais parfait...
Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
Si vous pensez avoir résolu vous même le bug (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (5723)
-
How to concatenate variables and strings as a full path for the "output file" of an ffmpeg command in a bash script
12 mai 2022, par djspatuleI'm trying to learn to bash scripting and I tried to use variables and arguments, etc. to specify a complex output file name to a ffmpeg command as follows :


for file in "$1"/*; do
 #get the name of each file in the directory (without the path nor the extension)
 filename=$(basename $file .mp3)
 #use mimic for Text To Speech. Difficult to install but good and natural voices.
 ~/Desktop/mimic1/mimic -t "$filename" -o $1/wavefile.wav
 #converts the wav file outputed by mimic into mp3
 ffmpeg -i $1/wavefile.wav -f mp3 "${1}/${filename} (title).mp3"
done




But the
"${1}/${filename} (title).mp3"
part in particular really doesn't seem to work...

Indeed, if I run
script.sh ./
, I get a file called (title).mp3

Can you help me figure out what it is I'm doing wrong ?
Thanks a million in advance.
Best,


P.S. : i also get earlier in the terminal's output
basename: extra operand ‘.mp3’
...like my whole code is wrong....?

-
Flask app using OpenCv crash when i start recording
17 mai 2023, par Mulham DarwishI build this flask app to live stream security cameras and the live stream works with the screenshot function but when start recording it crash but few times same code it worked and saved the video here the code. with the html file using js.


from flask import Flask, render_template, Response, request
import cv2
import os
import time
import threading
import requests

app = Flask(__name__)

# Define the IP cameras
cameras = [
 {'url': 'rtsp://****:*****@******', 'name': 'Camera 1'},
 {'url': 'rtsp://****:*****@******', 'name': 'Camera 2'},
 {'url': 'rtsp://****:*****@******', 'name': 'Camera 3'},
 {'url': 'rtsp://****:*****@******', 'name': 'Camera 4'}
]

# Create a VideoCapture object for each camera
capture_objs = [cv2.VideoCapture(cam['url']) for cam in cameras]
stop_events = {i: threading.Event() for i in range(len(cameras))}
# Define the directory to save the recorded videos
recording_dir = os.path.join(os.getcwd(), 'recordings')

# Ensure the recording directory exists
if not os.path.exists(recording_dir):
 os.makedirs(recording_dir)

# Define the function to capture and save a video
def record_video(camera_index, stop_recording):
 # Define the codec and file extension
 fourcc = cv2.VideoWriter_fourcc(*'mp4v')
 file_extension = '.mp4'

 # Get the current timestamp for the filename
 timestamp = time.strftime("%Y%m%d-%H%M%S")

 # Define the filename and path
 filename = f'{cameras[camera_index]["name"]}_{timestamp}{file_extension}'
 filepath = os.path.join(recording_dir, filename)

 # Create a VideoWriter object to save the video
 width = int(capture_objs[camera_index].get(cv2.CAP_PROP_FRAME_WIDTH))
 height = int(capture_objs[camera_index].get(cv2.CAP_PROP_FRAME_HEIGHT))
 fps = int(capture_objs[camera_index].get(cv2.CAP_PROP_FPS))
 video_writer = cv2.VideoWriter(filepath, fourcc, fps, (width, height))

 # Capture frames and write them to the file
 while True:
 if stop_recording.is_set():
 break # stop recording if stop_recording is set
 ret, frame = capture_objs[camera_index].read()
 if ret:
 video_writer.write(frame)
 else:
 break

 # Release the VideoWriter object and the VideoCapture object
 video_writer.release()
 capture_objs[camera_index].release()

@app.route('/')
def index():
 # Render the index page with the list of cameras
 return render_template('index.html', cameras=cameras)

def generate(camera_index):
 # Generate frames from the video feed
 while True:
 ret, frame = capture_objs[camera_index].read()
 if not ret:
 break

 # Encode the frame as JPEG
 _, jpeg = cv2.imencode('.jpg', frame)

 # Yield the frame as a Flask response
 yield (b'--frame\r\n'
 b'Content-Type: image/jpeg\r\n\r\n' + jpeg.tobytes() + b'\r\n')

@app.route('/video_feed')
def video_feed():
 # Get the camera index from the request arguments
 camera_index = int(request.args.get('camera_index'))

 # Generate the video feed
 return Response(generate(camera_index),
 mimetype='multipart/x-mixed-replace; boundary=frame')

@app.route('/record', methods=['POST'])
def record():
 # Get the camera index from the request form
 camera_index = int(request.form['camera_index'])

 stop_recording = stop_events[camera_index] # get the stop_recording event for the camera
 thread = threading.Thread(target=record_video, args=(camera_index, stop_recording))
 thread.start() # start a thread to record video

 # Return a response indicating that the recording has started
 return 'Recording started.'

@app.route('/stop_record', methods=['POST'])
def stop_record():
 # Get the camera index from the request form
 camera_index = int(request.form['camera_index'])

 # Set the stop_recording event for the corresponding camera thread
 stop_events[camera_index].set()

 # Return a response indicating that recording has been stopped
 return 'Recording stopped.'

@app.route('/screenshot', methods=['POST'])
def take_screenshot():
 # Take a screenshot of the video stream and save it as a file
 camera = capture_objs[int(request.form['camera_id'])]
 success, frame = camera.read()
 if success:
 timestamp = time.strftime("%Y%m%d-%H%M%S")
 filename = f'screenshot_{timestamp}.jpg'
 cv2.imwrite(filename, frame)
 return 'Screenshot taken and saved'
 else:
 return 'Failed to take screenshot'

if __name__ == '__main__':
 app.run()



I tried to update ffmpeg to the latest version and installed pip install opencv-python-headless and installed pip install opencv-python but most of the time i come to this crash code


* Serving Flask app 'run'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [17/May/2023 13:24:11] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:11] "GET /video_feed?camera_index=0 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:11] "GET /video_feed?camera_index=1 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:11] "GET /video_feed?camera_index=2 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:11] "GET /video_feed?camera_index=3 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:44] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:45] "GET /video_feed?camera_index=3 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:45] "GET /video_feed?camera_index=0 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:45] "GET /video_feed?camera_index=1 HTTP/1.1" 200 -
127.0.0.1 - - [17/May/2023 13:24:45] "GET /video_feed?camera_index=2 HTTP/1.1" 200 -
[h264 @ 0x5605285fc5c0] error while decoding MB 28 29, bytestream -9
[h264 @ 0x560529110040] error while decoding MB 15 37, bytestream -6
[h264 @ 0x560528624980] error while decoding MB 45 45, bytestream -23
[h264 @ 0x5605286f1900] error while decoding MB 50 34, bytestream -7
[h264 @ 0x5605285fc5c0] error while decoding MB 25 9, bytestream -17
[h264 @ 0x5605292b0080] error while decoding MB 28 41, bytestream -5
[h264 @ 0x560528660040] error while decoding MB 101 45, bytestream -17
[h264 @ 0x5605285fc5c0] error while decoding MB 42 44, bytestream -5
[h264 @ 0x5605286f1900] error while decoding MB 118 42, bytestream -9
[h264 @ 0x560529110040] error while decoding MB 92 43, bytestream -5
[h264 @ 0x560528660040] error while decoding MB 99 34, bytestream -11
[h264 @ 0x56052932b0c0] error while decoding MB 92 36, bytestream -13
[h264 @ 0x560528667ac0] error while decoding MB 44 54, bytestream -5
[h264 @ 0x560529110040] error while decoding MB 93 33, bytestream -7
[h264 @ 0x5605286dd880] error while decoding MB 27 37, bytestream -19
[h264 @ 0x560528660040] error while decoding MB 66 56, bytestream -9
127.0.0.1 - - [17/May/2023 13:36:45] "POST /record HTTP/1.1" 200 -
Assertion fctx->async_lock failed at libavcodec/pthread_frame.c:175
Aborted (core dumped)



-
Windows 2003 using php popen "start /b" because of executing ffmpeg.exe
1er juillet 2013, par Oh Seung KwonI have some problem.
There is a php code that convert audio(wav) to mp3 file with using ffmpeg.exe.
Here is some code.
$cmd = "./inc/ffmpeg.exe -i ".$file_name." -acodec mp3 -y -ac 1 -ab 96k ".$mp3_file_name;
echo $cmd;
echo "Windows";
$handle = popen("start /B ".$cmd, "r");
while(!feof($handle)) {
$read = fread($handle, 2096);
echo $read;
}
pclose($handle);Problem is when I execute this code, ffmpeg.exe process isn't terminated. And not gonna die when I stop process with using Windows task manager.
Do you have a solution for this situation ?