
Recherche avancée
Médias (3)
-
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
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (96)
-
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 (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)
Sur d’autres sites (8544)
-
threading with open cv and FFMPEG
3 février 2023, par share2020 uisI'm working on a project which get several CCTV streams and preform some processing with OpenCV. Then I want to get those streams back with rtmp/rtsp protocols.


I can use openCV with threading in python and preform my processing and return in scale of 4 frames from each stream sequentially.
Is there any way to use this python library and FFMPEG to send each stream to corresponding rtmp/rtsp with FFMPG ?


`class LoadStreams: # multiple IP or RTSP cameras
 def __init__(self, sources='streams.txt', img_size =(1290,720)):
 self.mode = 'images'
 self.img_size = img_size


 if os.path.isfile(sources):
 with open(sources, 'r') as f:
 sources = [x.strip() for x in f.read().splitlines() if len(x.strip())]
 else:
 sources = [sources]

 n = len(sources)
 self.imgs = [None] * n
 self.sources = sources
 for i, s in enumerate(sources):
 cap = cv2.VideoCapture(eval(s) if s.isnumeric() else s)
 assert cap.isOpened(), 'Failed to open %s' % s
 w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
 h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
 self.fps = cap.get(cv2.CAP_PROP_FPS) % 100
 _, self.imgs[i] = cap.read() # guarantee first frame
 thread = Thread(target=self.update, args=([i, cap]), daemon=True)
 print(' success (%gx%g at %.2f FPS).' % (w, h, self.fps))
 thread.start()


 def update(self, index, cap):
 n = 0
 while cap.isOpened():
 n += 1
 # _, self.imgs[index] = cap.read()
 cap.grab()
 if n == 4: # read every 4th frame
 _, self.imgs[index] = cap.retrieve()
 n = 0
 time.sleep(0.01) # wait time

 def __iter__(self):
 self.count = -1
 return self

 def __next__(self):
 self.count += 1
 img0 = self.imgs.copy()
 if cv2.waitKey(1) == ord('q'): # q to quit
 cv2.destroyAllWindows()
 raise StopIteration`





Being able to use ffmpeg for n frames from A_in streaming to A_out url and get n from B_in url stream to B_out url.


-
Can I trigger a command after ffmpeg writes a segment ?
28 décembre 2022, par user717847I am reading from an RTSP (camera) stream and writing segments, using ffmpeg. My command to do so is :


ffmpeg -rtsp_transport tcp -i rtsp://$camera_creds@$camera_ip/video/1 -map 0 -c:v h264 -preset:v ultrafast -reset_timestamps 1 -f segment -segment_time 300 -strftime 1 
-segment_list ${monitor_dir}/segments$camera.txt $monitor_dir/cam${camera}_out%Y%m%d_%H%M%S.mp4



It works fine to a point. My problem is that I want to do something with each segment once it has been written.


To accomplish this, I monitor the segmentsN.txt file for lines being added to it ; I then read the contents, do stuff (process, upload), and then remove the lines that I've already processed (so that I don't reprocess them).


The problem with this is that periodically, ffmpeg will start writing to a new segment, but apparently won't update the segments list file. Initially I thought this was because my "remove the lines" operation was writing a brand new file and replacing it in place (which it was), while ffmpeg was probably continuing to append to the inode it started out with (which it maybe was). Having fixed that, I think I now just have a race condition.


What I'd really like is to have ffmpeg change the filename once it has completed a segment, and/or move the completed segment file into a different folder. However, this doesn't seem like an option. Is there a more robust way to accomplish what I'm doing here ? I could just poll for multiple files with a given filename pattern, and process the earliest, circumventing the segments list file...but something more robust would be nice.


Thanks


-
cv::VideoWriter Class Failing to Write Frames to Video File
23 septembre 2022, par adav0033I am attempting to using the OpenCV VideoWriter class to save a two camera video feed to a single video file. I am using the FFMPEG API to ahcieve the desired outcome and am trying to generate an .mkv file with the Fourcc code FFV1 for lossless frame writing. Currently I am expriencing upon launching of the pipeline the file writer is creating a file in the directory specified and upon completion of the pipeline the writer is transformed into a video file .mkv however no frames are being written to said file.
My constructor :


cv::VideoWriter writer(out_vid_name + ".mkv", cv::VideoWriter::fourcc('F','F','V','1'), cam_fps,frame_double_size, true);



Note that cv::Size(3840,1080) = frame_double_size and cam_fps is a param


My video capture :


cv::VideoCapture cap(out_vid_name + ".mkv", cv::CAP_FFMPEG);



and my writer :


while (controller->running && ros::ok()) //Shutdown race condition exists. One thread will have to be SIGTERM'ed
 {
 std::shared_lock guard(doubleSaveFrame->mtx);
 doubleSaveFrame->cond_var.wait(guard, [&]{ return doubleSaveFrame->cond_bool_save; });
 doubleSaveFrame->cond_bool_save = false;
 std_msgs::String msg;
 msg.data = std::to_string(frame_count);
 frame_count++;
 frame_pub.publish(msg);

 writer.write(doubleSaveFrame->getHost());
 cv::Mat frame = doubleSaveFrame->getHost();
 int rows = frame.rows;
 int cols = frame.cols;
 std::cout << "rows: " << std::to_string(rows) << " cols: "<< std::to_string(cols) << std::endl;
 cv::imwrite("home/Documents/camera/imwritefun"+ std::to_string(frame_count) +".JPG", doubleSaveFrame->getHost());
 }
 writer.release();



Note that this code above produced successfully the camera frames to file when cv::imwrite was executed, however the the writer failed to write to video file. I am very new to OpenCV and the associated methods used here, if anyone has an idea on what is causing the issue that would be extremely helpful as research has not prevailed a solution.