
Recherche avancée
Médias (1)
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
Autres articles (34)
-
Qu’est ce qu’un masque de formulaire
13 juin 2013, parUn masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
Chaque formulaire de publication d’objet peut donc être personnalisé.
Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (9400)
-
Video fingerprinting not working for the video
2 septembre 2024, par Veer PratapI implemented video fingerprinting, and it works well when the videos are exactly the same, producing a similarity score of 1. However, I encounter an issue when comparing videos that have been merged in different orders. For instance, if I merge video1 and video2 to create a new video and then merge them in reverse order (video2 + video1), the system fails to detect any matching frames between the two resulting videos.


The challenge lies in comparing frames between videos regardless of their timing or order. How can I modify the comparison process to ensure that frames are matched correctly even when the order of video segments changes ?


use ffmpeg_next::{codec, format, frame, media, packet, Error};
use sha2::{Digest, Sha256};
use std::collections::HashSet;

pub fn extract_frames(video_path: &str) -> Result>, Error> {
 ffmpeg_next::init()?;
 let mut ictx = format::input(&video_path)?;
 let input_stream_index = ictx
 .streams()
 .best(media::Type::Video)
 .ok_or(Error::StreamNotFound)?
 .index();
 let codec_params = ictx
 .stream(input_stream_index)
 .ok_or(Error::StreamNotFound)?
 .parameters();
 let codec = codec::Id::from(codec_params.id());
 let mut decoder = codec::Context::from_parameters(codec_params)?
 .decoder()
 .video()?;
 let mut frame = frame::Video::empty();
 let mut frames = Vec::new();
 let mut packet_count = 0;
 let mut frame_count = 0;

 for (stream, packet) in ictx.packets() {
 packet_count += 1;
 if stream.index() == input_stream_index {
 decoder.send_packet(&packet)?;
 while let Ok(()) = decoder.receive_frame(&mut frame) {
 let frame_data = frame.data(0).to_vec();
 frames.push(frame_data);
 frame_count += 1;
 eprintln!("Extracted frame {}", frame_count);
 }
 }
 }
 eprintln!(
 "Processed {} packets and extracted {} frames",
 packet_count, frame_count
 );
 Ok(frames)
}

pub fn hash_frame(frame: &[u8]) -> Vec<u8> {
 let mut hasher = Sha256::new();
 hasher.update(frame);
 hasher.finalize().to_vec()
}

/// Generates a vector of fingerprints for the given video frames.
///
/// This function takes a vector of frames (each represented as a vector of bytes)
/// and generates a fingerprint for each frame using the SHA-256 hash function.
///
/// # Arguments
///
/// * `frames` - A vector of video frames, where each frame is a `Vec<u8>` representing the frame's raw data.
///
/// # Returns
///
/// * `Vec>` - A vector of fingerprints, where each fingerprint is a `Vec<u8>` representing the SHA-256 hash of the corresponding frame.
pub fn generate_fingerprints(frames: Vec>) -> Vec> {
 frames.into_iter().map(|frame| hash_frame(&frame)).collect()
}

/// Compares two videos by extracting frames and generating fingerprints, then computing the similarity between the two sets of fingerprints.
///
/// This function extracts frames from the two provided video files, generates fingerprints for each frame,
/// and compares the fingerprints to determine the similarity between the two videos.
///
/// # Arguments
///
/// * `video_path1` - A string slice that holds the path to the first video file.
/// * `video_path2` - A string slice that holds the path to the second video file.
///
/// # Returns
///
/// * `Result>` - The similarity score between the two videos as a floating-point value (0.0 to 1.0).
/// Returns an error if there is an issue with extracting frames or generating fingerprints.
///
/// # Errors
///
/// This function will return an error if:
/// * There is an issue with opening or reading the video files.
/// * There is an issue with extracting frames from the video files.
/// * There is an issue with generating fingerprints from the frames.
pub fn compare_videos(
 video_path1: &str,
 video_path2: &str,
) -> Result> {
 println!("Comparing videos: {} and {}", video_path1, video_path2);
 let frames1 = extract_frames(video_path1)?;
 let frames2 = extract_frames(video_path2)?;

 let fingerprints1: HashSet<_> = generate_fingerprints(frames1).into_iter().collect();
 let fingerprints2: HashSet<_> = generate_fingerprints(frames2).into_iter().collect();

 println!("Number of fingerprints in video 1: {}", fingerprints1.len());
 println!("Number of fingerprints in video 2: {}", fingerprints2.len());

 if !fingerprints1.is_empty() && !fingerprints2.is_empty() {
 println!(
 "Sample fingerprint from video 1: {:?}",
 fingerprints1.iter().take(1).collect::>()
 );
 println!(
 "Sample fingerprint from video 2: {:?}",
 fingerprints2.iter().take(1).collect::>()
 );
 }

 // Calculate Jaccard similarity
 let intersection_size = fingerprints1.intersection(&fingerprints2).count();
 let union_size = fingerprints1.union(&fingerprints2).count();

 println!("Intersection size: {}", intersection_size);
 println!("Union size: {}", union_size);

 let similarity = if union_size == 0 {
 0.0
 } else {
 intersection_size as f64 / union_size as f64
 };

 println!("Similarity score: {}", similarity);

 Ok(similarity)
}

</u8></u8></u8>


-
How do I properly format a request for ffmpeg to decode using a particular codec ? [migrated]
9 mai 2013, par user2062660r3d is listed as a supported codec for decoding, however when I attempt to specify the r3d decoder, I get the error message "Unknown decoder". What is the correct manner of specifying a decoder codec ?
me$ ffmpeg -c r3d -i one.r3d one.mpg
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
built on May 8 2013 19:48:08 with Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mp3 @ 0x7fa2e4006600] Format mp3 detected only with low score of 1, misdetection possible!
Unknown decoder 'r3d' -
We are hiring engineers to build an awesome product and platform used by millions of people
16 février 2016, par Piwik Core Team — JobsAre you ready for a new challenge ? Or maybe you know someone who is looking for a change ? We have some exciting problems to solve and are looking for senior developers to work with us and our community on our open source Piwik Analytics platform. Piwik is used by more than one million websites all over the world. It is deployed on more than 300.000 servers and some users track more than 1 billion actions per month.
What is it like to work on Piwik ?
We develop this software using modern PHP, MySQL, Redis, AngularJS and more. We provide several kind of APIs and a plugin architecture to allow developers to extend and change Piwik to their needs. However, we would not be Piwik if we stopped at this point ! We want to turn Piwik into an even more awesome product and platform.
You can imagine there is a lot to do and many challenges to face !While one part is to always make Piwik scale better and to improve UI and UX, we also want to provide simple APIs to make the life of developers as pleasant as possible. We aim to solve things the right way and our thousands of unit, integration, system, JavaScript and screenshot tests help us to innovate and to not be afraid of change. We like clean code and constant improvements.
The Piwik team lives in New Zealand, Europe (Poland, Germany) and in the U.S. We do the vast majority of our collaboration online. Our values include being open, transparent and sharing knowledge. For this we use tools like GitHub and Slack to communicate and Quake servers to take our minds off complex challenges. We are a small, flexible team, so when you come aboard, you will play an integral part in engineering and have a big impact on the product loved by so many people. You’ll help to create a welcoming environment for new contributors and set an example with your development practices and communications skills.
Apply now, or spread the word !
If you have strong skills in PHP send us an email with your CV and tell us a little about yourself and your experience in engineering complex applications.
Apply for a job here http://piwik.org/jobs/ and if you’re maybe not the right candidate, contribute to the project by sharing this blog post and by sending it to your friends !