
Recherche avancée
Autres articles (56)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, 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 (...) -
Submit enhancements and plugins
13 avril 2011If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone. -
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 (6422)
-
Issues with adding the current timestamp of a video when using FFPLAY
28 janvier 2023, par lalelarsen1Hi i am trying to add to display the current time of the video as an overlay. i have tried to do follow the answer of this previous post : https://superuser.com/questions/968685/how-to-display-current-time-with-the-ffplay-exe but with no luck.


This is my line of code :


"./ffmpeg-2023-01-25-git-2c3107c3e9-full_build/bin/ffplay.exe" -vf "drawtext=fontfile=./consola.ttf:text='%{pts:hms}':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black@0.75:x=(w-text_w)/2:y=h-text_h-20" -i "%shadowplays_folder%\%NEWEST_FOLDER%\%NEWEST_FILE%" -autoexit -x "1000" -alwaysontop



This will display the text "hms}" not the time.


the above code works fine if i replace it with a simple string :


"./ffmpeg-2023-01-25-git-2c3107c3e9-full_build/bin/ffplay.exe" -vf "drawtext=fontfile=./consola.ttf:text='test':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black@0.75:x=(w-text_w)/2:y=h-text_h-20" -i "%shadowplays_folder%\%NEWEST_FOLDER%\%NEWEST_FILE%" -autoexit -x "1000" -alwaysontop



This will display the text "test"


what am i missing ?


-
Parse dynamic mpd file with Media Source Extensions
17 février 2023, par FrankCI just started learning about adaptive streaming, and currently I'm working on a project that needs showing a live video. In order to control some of the elements in mpd file, I determined to use MSE instead of dash.js. I refer to the code at the following URL :https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/samples/dn551368(v=vs.85)
But I found out that there is no "Initialization" tag or "range" attribute in my mpd file. I don't find any relative attribute as well. By the way I'm use nginx-rtmp + ffmpeg to generate dash file.
So here is my dash file looks like


<?xml version="1.0"?>
 
 <period start="PT0S">
 
 
 
 <segmenttimeline>
 <s t="0" d="10000"></s>
 <s t="10000" d="10000"></s>
 <s t="20000" d="5000"></s>
 <s t="25000" d="10000"></s>
 </segmenttimeline>
 
 
 
 </period>




My question is :
1.Did I have any missing parameters in using ffmpeg or nginx-rtmp resulting in losting tag in mpd file ?
2.Or there is other way to setup "Initialization"/"range" attribute and let my program work ?
3.I also curious about why my mpd file doesn't have a baseURL element ?


※My mpd file works fine with dash.js, I can see the video properly


THANKS A LOT


-
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)