
Recherche avancée
Autres articles (66)
-
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 (...) -
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 (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...)
Sur d’autres sites (6519)
-
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


-
Python moviepy, CompositeVideoClip is Slow and Wierd
4 mars 2023, par DanI want to add a
.mov
transparent overlay on top of a.mp4
video, and for that I am usingmovipy
andCompositeVideoClip
, but it's too slow.

The speed is
40 it/s
when only the video is rendering but when it comes to the overlay it is only5 it/s
. To speed it up I have useduse_bgclip=True
and now I get90 it/s
but when the overlay comes I still get5 it/s
, and when I useuse_bgclip=True
there are 2 'bugs' that appears :

- 

- The video freezes after the overlay is done playing.
- The audio of the video is lost and the overlay sound is the only one left






For the two 'bugs', I found a good enough solution, but I want to speed up the process when the overlay comes, because
5 it/s
it's way too slow. I have tried to usecodec="h264_nvenc"
or highercrf
but the speed is the same.

Is there a way to speed this up ? (I don't care if I need to use other libraries)


import moviepy.editor as mp
video = mp.VideoFileClip("video.mp4")

overlay = mp.VideoFileClip("overlay.mov", has_mask=True)
overlay = overlay.set_start(5) # start the overlay 5 seconds after the video starts

compose = mp.CompositeVideoClip([video, overlay], use_bgclip=True, size=video.size)
compose = compose.set_duration(video.duration) # fix bug 1
compose = compose.set_audio(video.audio) # fix bug 2 (but I lost the audio from the overlay)

compose.write_videofile("cf15.mp4", codec="libx264", preset="veryfast", ffmpeg_params=["-crf", "15"])

compose.close()
video.close()



-
How to pause ffmpeg than runs without window ?
5 février 2015, par Zed MachineI’m working on a video converter and I wanted to be able to stop or pause ffmpeg by pressing a button. Googleing I have found a way but it’s not working. basically I Start ffmpeg on a background worker in this way :
Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
Dim Proc As New Process
Proc.StartInfo.UseShellExecute = False
Proc.StartInfo.RedirectStandardError = True
Proc.StartInfo.RedirectStandardOutput = True
Proc.StartInfo.FileName = current_ffmpeg_path
Proc.StartInfo.Arguments = input_params
Proc.StartInfo.CreateNoWindow = True
Proc.Start()
[do things...]then inside a loop I place an if to pause ffmpeg :
If (pause = 1 Or pause = 2) Then
AppActivate(Proc.Id)
SendKeys.SendWait("^(s)")
SetForegroundWindow(Me)
pause = 0
End Ifbut it’s not working.. maybe cause of AppActivate that need a window to work while instead ffmpeg is running without it. There is another way ? maybe not with sendkeys ?