Recherche avancée

Médias (91)

Autres articles (92)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 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 (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (4310)

  • cv::VideoWriter Class Failing to Write Frames to Video File

    23 septembre 2022, par adav0033

    I 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.

    


  • Can I trigger a command after ffmpeg writes a segment ?

    28 décembre 2022, par user717847

    I 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

    


  • threading with open cv and FFMPEG

    3 février 2023, par share2020 uis

    I'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`


    


    enter image description here

    


    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.