
Recherche avancée
Autres articles (80)
-
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 (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (6046)
-
How to append an image to a video using OpenCV or FFMPEG or Moviepy or other libraries ?
19 juillet 2022, par Trần Tiến VănDo you know a library in Python to add a frame image to an existing video ? The result video must have the same quality as the image.


I tried to use OpenCV to add google image : https://www.google.com/search?q=google&sxsrf=ALiCzsZhrdoHnOTmg0We4dxtguCqzma5Jg:1657603343101&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiTh8bTzfL4AhWhplYBHfXNAKwQ_AUoAXoECAIQAw&biw=1492&bih=739&dpr=1.25#imgrc=PRtenhDnrVrfOM


But the quality decreases when the video elongates.


Here is the final result video : https://drive.google.com/file/d/1ArDvoX-kN9H_oLbACk3kU1Cid93SMczC/view?usp=sharing


Here is my code using OpenCV :


image = cv2.imread(path_image)
 height, width, dimensions = image.shape
 
 video = cv2.VideoCapture(path_video)
 
 
 frames = []
 while(True):
 
 ret, frame = video.read()
 
 if ret == True: 
 frames.append(frame)
 # frame = frame.resize(frame, (width, height), fx=0, fy=0, interpolation = cv2.INTER_CUBIC)
 
 # Press S on keyboard 
 # to stop the process
 if cv2.waitKey(1) & 0xFF == ord('s'):
 break
 # Break the loop
 else:
 break
 
 video2 = cv2.VideoWriter(path_video,cv2.VideoWriter_fourcc('M','J','P','G'), 30, (width, height))
 for frame in frames:
 video2.write(frame)
 video2.write(image)
 video2.release() # releasing the video generated 
 print("Added {}".format(image_name))



I hope to improve the quality of this video.


-
OpenCV : FFMPEG : tag is not supported with codec id 12 and format 'mp4 / MP4
30 septembre 2023, par Tina JI was trying to run a repo located HERE. Basically, just targeting
SimpleVideoSummarizer.cc
which uses OpenCV for some basic video processing. I'm using Ubuntu 14.04. Following is the save part of the code :


void SimpleVideoSummarizer::playAndSaveSummaryVideo(char* videoFileSave) {
 cv::VideoCapture capture(videoFile);
 cv::Mat frame;
 capture.set(CV_CAP_PROP_POS_FRAMES, 0);
 cv::VideoWriter videoWriter;
 if (videoFileSave != "") {
 videoWriter = cv::VideoWriter(videoFileSave, CV_FOURCC('M', 'J', 'P', 'G'), static_cast<int>(capture.get(CV_CAP_PROP_FPS)), cv::Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)));
 }
 for (std::set<int>::iterator it = summarySet.begin(); it != summarySet.end(); it++) {
 capture.set(CV_CAP_PROP_POS_FRAMES, segmentStartTimes[*it] * frameRate);
 for (int i = segmentStartTimes[*it]; i < segmentStartTimes[*it + 1]; i++) {
 for (int j = 0; j < frameRate; j++) {
 capture >> frame;
 cv::putText(frame, "Time: " + IntToString(i) + " seconds", cvPoint(30, 30),
 cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cvScalar(200, 200, 250), 1, CV_AA);
 if (frame.data) {
 cv::imshow("Summary Video", frame);
 }
 if (videoFileSave != "") {
 videoWriter.write(frame);
 }
 // Press ESC on keyboard to exit
 char c = static_cast<char>(cv::waitKey(25));
 if (c == 27) {
 break;
 }
 }
 }
 }
 capture.release();
}
</char></int></int>



I pass an
input.mp4
file and specify aout.mp4
as well. Unfortunately, when the example is trying to save the output video file, it throws errors on the FOURCC :


OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'




or another one :



OpenCV: FFMPEG: tag 0x3234504d/'MP42' is not supported with codec id 15 and format 'mp4 / MP4 (MPEG-4 Part 14)'
[mp4 @ 0x16bc700] Could not find tag for codec msmpeg4v2 in stream #0, codec not currently supported in container




I tried to change the FOURCC in this part of the code which writes the video, and applied XVID, MJPG, X264, MP42, MP4V. None worked and threw similar errors.



What is the problem ? How to fix it ?


-
Why am I having issues re-encoding rtsp stream to rtmp via FFMPEG-python ? [closed]
27 août 2023, par Luke LopezI can see that the python script is not throwing errors however I cant stream the video via VLC player.



 Metadata:
 title : Media Server
 encoder : Lavf60.3.100
 Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv, progressive), 640x360, q=2-31, 1 kb/s, 25 fps, 1k tbn
 Metadata:
 encoder : Lavc60.3.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/1000 buffer size: 0 vbv_delay: N/A
frame= 1927 fps= 25 q=69.0 size= 92kB time=00:01:17.00 bitrate= 9.7kbits/s dup=13 drop=1 speed=0.98x 



import subprocess

# Input RTSP stream URL
input_stream_url = "rtsp://myStream"

# Wowza RTMP or RTSP URL (replace with your Wowza server's details)
wowza_url = "rtmp://myWowzaServer"

# Resolution 
desired_width = 640
desired_height = 360

# Video bitrate and frame rate settings
video_bitrate = "1240" # 1240 Kbps
fps = 25

# Start FFmpeg process to pull and push the stream with specified settings
ffmpeg_command = [
 'ffmpeg',
 '-rtsp_transport', 'tcp', # Use TCP for RTSP transport (optional)
 '-i', input_stream_url, # Input RTSP stream URL
 '-s', f'{desired_width}x{desired_height}', # Desired resolution
 '-c:v', 'libx264', # Video codec: H.264
 '-b:v', video_bitrate, # Video bitrate
 '-r', str(fps), # Frame rate
 '-c:a', 'aac', # Audio codec: AAC
 '-f', 'flv', # Output format (FLV for RTMP, rtsp for RTSP)
 wowza_url # Wowza RTMP or RTSP URL
]

# Start FFmpeg as a subprocess
ffmpeg_process = subprocess.Popen(ffmpeg_command)

# Stop Condition
print("Press Enter to stop...")
input()

# Terminate FFmpeg when done
ffmpeg_process.terminate()




So far I have tried implementing best encoding practices as recommended by Wowza, have been messing with the frame rate, bitrate etc... but with no luck. Hopefully someone experienced with using FFMpeg can give suggestions / solutions ??


Thanks !