
Recherche avancée
Médias (3)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (71)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
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 (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)
Sur d’autres sites (9294)
-
piping data into an ffmpeg subprocess. Why does write() get stuck ? [closed]
12 mai 2024, par TebyyIt displays the number of frames at the beginning and shows that there are over 300, but when I count all the frames in the loop, the last one I see is 53, and then it only displays the value of 'ret', which is always true. I'm wondering what could be causing this issue of not reading all the frames, resulting in the file not being closed after reading. From what I've read, 'ret' should return false when there are no more frames to read, but because it's not reading all the frames, this isn't happening. Does anyone have any idea what could be causing this ?


Edit : I solved the problem by adding a Thread. Thanks everyone for the help !


I changed those lines of code :


recogniteAndPushFramesToFfmpeg("video-979257305707693982.mp4", ffmpeg_process)
# In function "recogniteAndPushFramesToFfmpeg"
process.stdin.write(frame)



to these :


ffmpeg_thread = Thread(target=recogniteAndPushFramesToFfmpeg, args=("video-979257305707693982.mp4", ffmpeg_process))
ffmpeg_thread.start()
# In function "recogniteAndPushFramesToFfmpeg"
process.stdin.write(frame.tobytes())



Code :


import subprocess
import cv2

def recogniteAndPushFramesToFfmpeg(video_path, process):
 cap = cv2.VideoCapture(video_path)
 i = 1
 print('Frames:', cap.get(cv2.CAP_PROP_FRAME_COUNT))
 while cap.isOpened():
 ret, frame = cap.read()
 print(ret)
 if not ret:
 break

 process.stdin.write(frame)
 process.stdin.flush()
 print('Frame:', i)
 i += 1

 cap.release()
 process.stdin.close()
 #process.wait()
 return
 

ffmpeg_command = [
 'ffmpeg', '-f', 'rawvideo', '-s:v', '1920x1080', '-r', '60',
 '-i', '-', '-vf', 'setpts=2.5*PTS',
 '-c:v', 'libvpx-vp9', '-g', '60',
 '-f', 'webm', '-'
]
ffmpeg_process = subprocess.Popen(ffmpeg_command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
recogniteAndPushFramesToFfmpeg("video-979257305707693982.mp4", ffmpeg_process)



Python Logs :


Frames: 328.0
...
True
Frame 50
True
Frame 51
True
Frame 52
True
Frame 53
True



I placed
cap.isOpened()
in the loop to check if it always returns true, and when I printed it, it always showed true

Link to video : Tested Video


-
How to parallelize ffmpeg setPTS filter when using GPU ? [closed]
28 février, par Souvic ChakrabortyWe have a long python code which chunks the video into multiple parts and changes the speed using setPTS filter.


import ffmpeg
ffmpeg.input(segment_path).filter("setpts", f"{1/speed_factor}*PTS").output(
 adjusted_segment_path,vcodec="h264_nvenc", acodec="aac",preset="fast", crf=23, g=30, keyint_min=30, sc_threshold=0,r=30,vsync='cfr',threads=1
 ).global_args("-hwaccel", "cuda").run(quiet=True, overwrite_output=True,capture_stdout=True, capture_stderr=True)



Now, because this happens multiple times before concatenation, we thought, instead of sequential processing using a ThreadPool, it may help reduce the time.
So we did that :


import ffmpeg
import concurrent.futures

def process_video(segment_path, adjusted_segment_path, speed_factor):
 ffmpeg.input(segment_path).filter("setpts", f"{1/speed_factor}*PTS").output(
 adjusted_segment_path,
 vcodec="h264_nvenc",
 acodec="aac",
 preset="fast",
 crf=23,
 g=30,
 keyint_min=30,
 sc_threshold=0,
 r=30,
 vsync='cfr',
 threads=1
 ).global_args("-hwaccel", "cuda").run(
 quiet=True, overwrite_output=True, capture_stdout=True, capture_stderr=True
 )


segment_paths = ["input1.mp4", "input2.mp4", "input3.mp4"] # List of input video segments
output_paths = ["output1.mp4", "output2.mp4", "output3.mp4"] # Corresponding output paths
speed_factor = 1.5 

# Using ThreadPoolExecutor for concurrent processing
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
 futures = [
 executor.submit(process_video, seg, out, speed_factor)
 for seg, out in zip(segment_paths, output_paths)
 ]
 
 # Wait for all tasks to complete
 for future in concurrent.futures.as_completed(futures):
 try:
 future.result() # This will raise any exceptions encountered in the thread
 except Exception as e:
 print(f"Error processing video: {e}")



But the time required did not reduce. Previously, it was 50 seconds for a long video input, now too, it remains the same.


Is there any other way I can improve the code ?


I also noticed the GPU utilization is low and the code is still executed sequentially (I can see when I run nvtop, which processes are running)


I am using an L4 GPU with CUDA Version : 12.4, nvcc CUDA Toolkit is also at 12.4


-
nginx-rtmp module with ffmpeg
1er janvier 2017, par saraI am new in video live streaming.I searched and found nginx-rtmp module to create a my media server,
when i saw that ,
i understood that we can run ffmpeg command in ngnix to transcode my video , or create a hls-variants , and this commands apply on videos on the fly . am i true ?
if it is true , so with large video it takes a long time to tarnscode on the fly .so i wanna to execute my ffmpeg command when i sotre my video in my hls file path. so i create a hls files(.ts) first with running ffmpeg commands.and then i serve my files with ngnix-rtmp module.
now my question is this 2 approaches(run async and sync(on the fly) ffmpeg command ) are true ?
i saw a lot of example that implement first approach.and i interested in using second approach .second approach is not a common approach ?why ?is this approach has a problem and issue that i am not aware of that ?
tnx