
Recherche avancée
Autres articles (21)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (5069)
-
FFmpeg vidstab generates jerky wiggling video
27 mars 2022, par praet0ri4nI run Kdenlive 21.12.3 on Ubuntu 20.04.
Recently I stared editing footage from my Nikon D3100 DSLR. Source videos are 1920:1080 24fps in MOV format (camera set to PAL system).


After trying to stabilize a video where I am walking I noticed that the result is kind of stabilized but the image is distorted and contains some strange wiggling effect. Changing the stabilization settings doesn't have any impact on this effect. I haven't seen this before. Previously I stabilized footage from other cameras without problems. This is the first time I use that DSLR.


To me it looks like stabilization is doing some strange interpolation and it is stretching and skewing the image or pixel aspect ratio.
For convenience I tried the vidstab filter with ffmpeg, played around with the interpol option too, but the result ist exactly the same.


Here the source MOV and stabilized mp4 file for comparison
https://nc.p1p0.eu/index.php/s/tTQgPj9rDbmReYn


Thank you !


-
How to save last 30 seconds of video in py
5 juin 2024, par Mateus CoelhoI want the last 30 seconds to be recorded every time I click enter and sent to the cloud. for example, if I click at 00:10:30, I want a video that records from 00:10:00 to 00:10:30 and if I click in sequence at 00:10:32, I need another different video that in its content is recorded from 00:10:02 to 00:10:32.


I think I have a problem where I will always end up recovering from the same buffer in the last 30 seconds. Is there any approach so that whenever I click enter I retrieve a unique video ? Is my current approach the best for the problem ? Or should I use something else ?


import subprocess
import os
import keyboard
from datetime import datetime
from google.cloud import storage

# Configuration
STATE = "mg"
CITY = "belohorizonte"
COURT = "duna"
RTSP_URL = "rtsp://Apertai:130355va@192.168.0.2/stream1"
BUCKET_NAME = "apertai-cloud"
CREDENTIALS_PATH = "C:/Users/Abidu/ApertAI/key.json"

def start_buffer_stream():
 # Command for continuous buffer that overwrites itself every 30 seconds
 buffer_command = [
 'ffmpeg',
 '-i', RTSP_URL,
 '-map', '0',
 '-c', 'copy',
 '-f', 'segment',
 '-segment_time', '30', # Duration of each segment
 '-segment_wrap', '2', # Number of segments to wrap around
 '-reset_timestamps', '1', # Reset timestamps at the start of each segment
 'buffer-%03d.ts' # Save segments with a numbering pattern
 ]
 return subprocess.Popen(buffer_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

def save_last_30_seconds_from_buffer(buffer_file):
 datetime_now = datetime.now()
 datetime_now_formatted = f"{datetime_now.day:02}{datetime_now.month:02}{datetime_now.year}-{datetime_now.hour:02}{datetime_now.minute:02}"
 output_file_name = os.path.abspath(f"{STATE}-{CITY}-{COURT}-{datetime_now_formatted}.mp4")

 # Copy the most recent buffer segment to the output file
 save_command = [
 'ffmpeg',
 '-i', buffer_file,
 '-c', 'copy',
 output_file_name
 ]
 subprocess.run(save_command, check=True)
 print(f"Saved last 30 seconds: {output_file_name}")
 return output_file_name

def upload_to_google_cloud(file_name):
 client = storage.Client.from_service_account_json(CREDENTIALS_PATH)
 bucket = client.bucket(BUCKET_NAME)
 blob = bucket.blob(os.path.basename(file_name).replace("-", "/"))
 blob.upload_from_filename(file_name, content_type='application/octet-stream')
 print(f"Uploaded {file_name} to {BUCKET_NAME}")
 os.remove(file_name) # Clean up the local file

def main():
 print("Starting continuous buffer for RTSP stream...")
 start_time = datetime.now()
 buffer_process = start_buffer_stream()
 print("Press 'Enter' to save the last 30 seconds of video...")

 while True:
 # Verify if 30 seconds has passed since start
 if keyboard.is_pressed('enter'):
 print("Saving last 30 seconds of video...")
 elapsed_time = (datetime.now() - start_time).total_seconds()
 # Determine which buffer segment to save
 if elapsed_time % 60 < 30:
 buffer_file = 'buffer-000.ts'
 else:
 buffer_file = 'buffer-001.ts'
 final_video = save_last_30_seconds_from_buffer(buffer_file)
 upload_to_google_cloud(final_video)

if _name_ == "_main_":
 main()





-
avutil/threadmessage : split the pthread condition in two
1er décembre 2015, par Clément Bœschavutil/threadmessage : split the pthread condition in two
Fix a dead lock under certain conditions. Let’s assume we have a queue of 1
message max, 2 senders, and 1 receiver.Scenario (real record obtained with debug added) :
[...]
SENDER #0 : acquired lock
SENDER #0 : queue is full, wait
SENDER #1 : acquired lock
SENDER #1 : queue is full, wait
RECEIVER : acquired lock
RECEIVER : reading a msg from the queue
RECEIVER : signal the cond
RECEIVER : acquired lock
RECEIVER : queue is empty, wait
SENDER #0 : writing a msg the queue
SENDER #0 : signal the cond
SENDER #0 : acquired lock
SENDER #0 : queue is full, wait
SENDER #1 : queue is full, waitTranslated :
- initially the queue contains 1/1 message with 2 senders blocking on
it, waiting to push another message.
- Meanwhile the receiver is obtaining the lock, read the message,
signal & release the lock. For some reason it is able to acquire the
lock again before the signal wakes up one of the sender. Since it
just emptied the queue, the reader waits for the queue to fill up
again.
- The signal finally reaches one of the sender, which writes a message
and then signal the condition. Unfortunately, instead of waking up
the reader, it actually wakes up the other worker (signal = notify
the condition just for 1 waiter), who can’t push another message in
the queue because it’s full.
- Meanwhile, the receiver is still waiting. Deadlock.This scenario can be triggered with for example :
tests/api/api-threadmessage-test 1 2 100 100 1 1000 1000One working solution is to make av_thread_message_queue_send,recv()
call pthread_cond_broadcast() instead of pthread_cond_signal() so both
senders and receivers are unlocked when work is done (be it reading or
writing).This second solution replaces the condition with two : one to notify the
senders, and one to notify the receivers. This prevents senders from
notifying other senders instead of a reader, and the other way around.
It also avoid broadcasting to everyone like the first solution, and is,
as a result in theory more optimized.