
Recherche avancée
Autres articles (49)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (7478)
-
FFMPEG merge mp4 file and mp3 file into mp4
10 avril 2017, par Cường TrầnI have video file in mp4 format (video.mp4), its length is 20 seconds. From 0 seconds to 10 seconds, the video has sound, and from 10 seconds to 20 seconds, there is no sound.
I also have mp3 file (audio.mp3) and has length 10 seconds.
I want to merge video.mp4 and audio.mp3 into result.mp4. The result.mp4 file should have video stream and its audio stream from 01 second to 10 seconds as original and audio stream from 10 seconds to 20 seconds of audio.mp3 as merged.
I use the command to merge :
ffmpeg -i video.mp4 -i audio.mp3 -filter_complex "aevalsrc=0:d=10[s1];[s1][1:a]concat=n=2:v=1:a=1[aout]" -c:v copy -map 0:v -map [aout] result.mp4
But i get the result.mp4 with video : there is no sound from 01-10 seconds, only new sound from 10-20 seconds.
It is the seem that my command don’t keep the sound from original mp4 file, it has removed it and just keep the new sound.
Could you please help ?
-
OpenCV reading from live camera creates a short video that moves quickly
17 novembre 2022, par user19019404I am reading in a live vide stream from a CCTV camera. The camera is set to 5 fps, another is set to 25fps and another to 30fps. Irrespective of the FPS that the camera is set, I can record 5 minutes but end up with a 30 second recorded clip where everyone is running around the scene.


My code is the 'typical' read in video and write video code that you would find online such as (code below simplified for readability) :


import cv2

video = cv2.VideoCapture(live RTSP address of camera)

if (video.isOpened() == False):
 print("Error reading video file")
else:
 frame_width = video.get(cv2.CAP_PROP_FRAME_WIDTH)
 frame_height = video.get(cv2.CAP_PROP_FRAME_HEIGHT)
 frame_fps = video.get(cv2.CAP_PROP_FPS)
 size = (frame_width, frame_height)
 result = cv2.VideoWriter('filename.avi',cv2.VideoWriter_fourcc(*'MJPG'),frame_fps , size)

 while(True):
 ret, frame = video.read()
 if ret == True:
 result.write(frame)
 cv2.imshow('Frame', frame)
 if cv2.waitKey(1) & 0xFF == ord('s'):
 break
 else:
 break
 video.release()
 result.release()
 cv2.destroyAllWindows()
print("The video was successfully saved with new fps")



I have tried playing with the FPS by reading in the FPS from the live camera and using the same FPS in the video write, but all that results is a video that is a fraction of the real time and with people zooming around the scene. So watching a 5 minute smooth video results in a 20 second recorded video with everyone zooming around.


Is this something that I need to fix in the writing of the video or do I need a second pass with ffmpeg to readjust the video ?


Much appreciated


Update, corrected the code above and :
When printing the frames read and the frame written the numbers are the same, showing that each frame that is read is being written (so I am not losing frames along the way thereby writing half the amount of frames).


-
FFMpeg ZeroMQ Filter stops working after a short while
22 septembre 2017, par Casper AlantI run FFMpeg as follows :
#!/bin/bash
fc="[1]scale=iw/2:ih/2 [pip]; [pip] zmq=bind_address=tcp\\\://127.0.0.1\\\:1235,[0]overlay=x=0:y=0"
ffmpeg -v verbose -re -y -i test.mkv -i test2.mkv -filter_complex "$fc" -f mpegts -codec:v libx264 -preset ultrafast resultzmq.mp4I then start a Python 3 app to send zmq commands to FFMpeg :
import zmq
import time
import sys
from multiprocessing import Process
context = zmq.Context()
port = "1235"
print("Connecting to server with port {}".format(port))
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:{}".format(port))
for request in range (20):
print("Sending request ", request, "...")
socket.send_string("Parsed_overlay_2 x 200")
message = socket.recv()
print("Received reply ", request, "[", message, "]")
time.sleep (1)Which runs fine up until about 40 seconds when I get this from Ffmpeg (it stops getting the command) :
frame= 918 fps= 24 q=19.0 size= 12192kB time=00:00:38.82 bitrate=2572.6kbits
frame= 931 fps= 24 q=19.0 size= 12402kB time=00:00:39.30 bitrate=2585.1kbits
[Parsed_zmq_1 @ 0x56185e089220] Processing command #8 target:Parsed_overlay_2 command:x arg:200
[Parsed_zmq_1 @ 0x56185e089220] Sending command reply for command #8:
0 Success
frame= 938 fps= 24 q=19.0 size= 12516kB time=00:00:39.82 bitrate=2574.1kbits/frame= 952 fps= 24 q=19.0 size= 12752kB time=00:00:40.33 bitrate=2590.0kbits/[Parsed_zmq_1 @ 0x56185e089220] Processing command #9 target:Parsed_overlay_2 command:x arg:200
[Parsed_zmq_1 @ 0x56185e089220] Sending command reply for command #9:
0 Success
frame= 963 fps= 24 q=19.0 size= 12932kB time=00:00:40.81 bitrate=2595.6kbits
frame= 976 fps= 24 q=19.0 size= 13121kB time=00:00:41.31 bitrate=2601.4kbits
frame= 992 fps= 24 q=19.0 size= 13434kB time=00:00:41.84 bitrate=2629.9kbits
frame= 1002 fps= 24 q=18.0 size= 13582kB time=00:00:42.34 bitrate=2627.2kbitsand this from the Python 3 client :
Sending request 8 ...
Received reply 8 [ b'0 Success' ]
Sending request 9 ...
Received reply 9 [ b'0 Success' ]
Sending request 10 ...The disconnect always happens at the same time, no matter when I start the Python client. If I start it after 40 seconds, it won’t send any commands at all.
On my actual application, the same thing happens but at about 60 seconds.
I tried setting up a simple Python server/client and the problem does not occur. So I assume the problem must have something to do with FFMpeg and its zmq plugin ?
If you would like to test this yourself, just make sure test.mkv and test2.mkv is some video longer than 1 minute.
I would really appreciate any assistance !