
Recherche avancée
Autres articles (52)
-
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 ;
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
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 (9354)
-
Affectiva drops every second frame
19 juin 2019, par machineryI am running Affectiva SDK 4.0 on a GoPro video recording. I’m using a C++ program on Ubuntu 16.04. The GoPro video was recorded with 60 fps. The problem is that Affectiva only provides results for around half of the frames (i.e. 30 fps). If I look at the timestamps provided by Affectiva, the last timestamp matches the video duration, that means Affectiva somehow skips around every second frame.
Before running Affectiva I was running ffmpeg with the following command to make sure that the video has a constant frame rate of 60 fps :
ffmpeg -i in.MP4 -vf -y -vcodec libx264 -preset medium -r 60 -map_metadata 0:g -strict -2 out.MP4 null 2>&1
When I inspect the presentation timestamp using
ffprobe -show_entries frame=pict_type,pkt_pts_time -of csv -select_streams v in.MP4
I’m getting for the raw video the following values :Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/GoPro_concat/GoPro_concat.MP4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 01:14:46.75, start: 0.000000, bitrate: 15123 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], 14983 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
handler_name : GoPro AVC
timecode : 13:17:26:44
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : GoPro AAC
Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
Metadata:
handler_name : GoPro AVC
timecode : 13:17:26:44
Unsupported codec with id 0 for input stream 2
frame,0.000000,I
frame,0.016683,P
frame,0.033367,P
frame,0.050050,P
frame,0.066733,P
frame,0.083417,P
frame,0.100100,P
frame,0.116783,P
frame,0.133467,I
frame,0.150150,P
frame,0.166833,P
frame,0.183517,P
frame,0.200200,P
frame,0.216883,P
frame,0.233567,P
frame,0.250250,P
frame,0.266933,I
frame,0.283617,P
frame,0.300300,P
frame,0.316983,P
frame,0.333667,P
frame,0.350350,P
frame,0.367033,P
frame,0.383717,P
frame,0.400400,I
frame,0.417083,P
frame,0.433767,P
frame,0.450450,P
frame,0.467133,P
frame,0.483817,P
frame,0.500500,P
frame,0.517183,P
frame,0.533867,I
frame,0.550550,P
frame,0.567233,P
frame,0.583917,P
frame,0.600600,P
frame,0.617283,P
frame,0.633967,P
frame,0.650650,P
frame,0.667333,I
frame,0.684017,P
frame,0.700700,P
frame,0.717383,P
frame,0.734067,P
frame,0.750750,P
frame,0.767433,P
frame,0.784117,P
frame,0.800800,I
frame,0.817483,P
frame,0.834167,P
frame,0.850850,P
frame,0.867533,P
frame,0.884217,P
frame,0.900900,P
frame,0.917583,P
frame,0.934267,I
frame,0.950950,P
frame,0.967633,P
frame,0.984317,P
frame,1.001000,P
frame,1.017683,P
frame,1.034367,P
frame,1.051050,P
frame,1.067733,I
...I have uploaded the full output on OneDrive.
If I run Affectiva on the raw video (not processed by ffmpeg) I face the same problem of dropped frames. I was using Affectiva with
affdex::VideoDetector detector(60);
Is there a problem with the ffmpeg command or with Affectiva ?
Edit : I think I have found out where the problem could be. It seems that Affectiva is not processing the whole video but just stops after a certain amount of processed frames without any error message. Below I have posted the C++ code I’m using. In the
onProcessingFinished()
method I’m printing something to the console when the processing is finished. But this message is never printed, so Affectiva never comes to the end.Is there something wrong with my code or should I encode the videos into another format than MP4 ?
#include "VideoDetector.h"
#include "FrameDetector.h"
#include <iostream>
#include <fstream>
#include <mutex>
#include
std::mutex m;
std::condition_variable conditional_variable;
bool processed = false;
class Listener : public affdex::ImageListener {
public:
Listener(std::ofstream * fout) {
this->fout = fout;
}
virtual void onImageCapture(affdex::Frame image){
//std::cout << "called";
}
virtual void onImageResults(std::map faces, affdex::Frame image){
//std::cout << faces.size() << " faces detected:" << std::endl;
for(auto& kv : faces){
(*this->fout) << image.getTimestamp() << ",";
(*this->fout) << kv.first << ",";
(*this->fout) << kv.second.emotions.joy << ",";
(*this->fout) << kv.second.emotions.fear << ",";
(*this->fout) << kv.second.emotions.disgust << ",";
(*this->fout) << kv.second.emotions.sadness << ",";
(*this->fout) << kv.second.emotions.anger << ",";
(*this->fout) << kv.second.emotions.surprise << ",";
(*this->fout) << kv.second.emotions.contempt << ",";
(*this->fout) << kv.second.emotions.valence << ",";
(*this->fout) << kv.second.emotions.engagement << ",";
(*this->fout) << kv.second.measurements.orientation.pitch << ",";
(*this->fout) << kv.second.measurements.orientation.yaw << ",";
(*this->fout) << kv.second.measurements.orientation.roll << ",";
(*this->fout) << kv.second.faceQuality.brightness << std::endl;
//std::cout << kv.second.emotions.fear << std::endl;
//std::cout << kv.second.emotions.surprise << std::endl;
//std::cout << (int) kv.second.emojis.dominantEmoji;
}
}
private:
std::ofstream * fout;
};
class ProcessListener : public affdex::ProcessStatusListener{
public:
virtual void onProcessingException (affdex::AffdexException ex){
std::cerr << "[Error] " << ex.getExceptionMessage();
}
virtual void onProcessingFinished (){
{
std::lock_guard lk(m);
processed = true;
std::cout << "[Affectiva] Video processing finised." << std::endl;
}
conditional_variable.notify_one();
}
};
int main(int argc, char ** argsv)
{
affdex::VideoDetector detector(60, 1, affdex::FaceDetectorMode::SMALL_FACES);
//affdex::VideoDetector detector(60, 1, affdex::FaceDetectorMode::LARGE_FACES);
std::string classifierPath="/home/wrafael/affdex-sdk/data";
detector.setClassifierPath(classifierPath);
detector.setDetectAllEmotions(true);
// Output
std::ofstream fout(argsv[2]);
fout << "timestamp" << ",";
fout << "faceId" << ",";
fout << "joy" << ",";
fout << "fear" << ",";
fout << "disgust" << ",";
fout << "sadness" << ",";
fout << "anger" << ",";
fout << "surprise" << ",";
fout << "contempt" << ",";
fout << "valence" << ",";
fout << "engagement" << ",";
fout << "pitch" << ",";
fout << "yaw" << ",";
fout << "roll" << ",";
fout << "brightness" << std::endl;
Listener l(&fout);
ProcessListener pl;
detector.setImageListener(&l);
detector.setProcessStatusListener(&pl);
detector.start();
detector.process(argsv[1]);
// wait for the worker
{
std::unique_lock lk(m);
conditional_variable.wait(lk, []{return processed;});
}
fout.flush();
fout.close();
}
</mutex></fstream></iostream>Edit 2 : I have now digged further into the problem and looked only at one GoPro file with a duration of 19min 53s (GoPro splits the recordings). When I run Affectiva with
affdex::VideoDetector detector(60, 1, affdex::FaceDetectorMode::SMALL_FACES);
on that raw video the following file is produced. Affectiva stops after 906s without any error message and without printing "[Affectiva] Video processing finised".When I now transform the video using
ffmpeg -i raw.MP4 -y -vcodec libx264 -preset medium -r 60 -map_metadata 0:g -strict -2 out.MP4
and then run Affectiva withaffdex::VideoDetector detector(60, 1, affdex::FaceDetectorMode::SMALL_FACES);
, Affectiva runs until the end and prints
"[Affectiva] Video processing finised" but the frame rate is only at 23 fps. Here is the file.When I now run Affectiva with
affdex::VideoDetector detector(62, 1, affdex::FaceDetectorMode::SMALL_FACES);
on this transformed file, Affectiva stops after 509s and "[Affectiva] Video processing finised" is not printed. Here is the file. -
No such file or directory - the ffprobe binary could not be found error
22 juin 2016, par rahulI am using carrierwave-video gem uploading videos through carrierwave and it’s not working.
video_uploader.rb
class VideoUploader < CarrierWave::Uploader::Base
include CarrierWave::Video
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
endvideo.rb
class Video < ActiveRecord::Base
mount_uploader :file, VideoUploader
def set_success(format, opts)
self.success = true
end
endThe error I am getting is :
No such file or directory - the ffprobe binary could not be found in /home/administrator/.rvm/gems/ruby-2.3.0/bin:/home/administrator/.rvm/gems/ruby-2.3.0@global/bin:/usr/share/rvm/rubies/ruby-2.3.0/bin:/usr/share/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
-
ffmpeg : trim / concat results in different length videos
4 mai 2019, par Mads Lee JensenIm experimenting with the
trim
andconcat
filters.I wanted to simply split up a video into X chunks, and
concat
it again. I expected the result would be a video with same frames / duration.So i have a video encoded with 1 fps and contains 3 frames, the duration of this video is 3 seconds.
i run the following script
ffmpeg -y -i fps.mp4 -an -filter_complex "[0:v]trim=0:1[v1];[0:v]trim=1:2[v2];[0:v]trim=2:3[v3];[v1][v2][v3] concat=n=3:v=1 [out]" -map [out] out.mp4
The result is a video with a duration of 4 seconds to inspect the problem i called :
ffprobe -print_format json -show_frames out.mp4
It shows that there is now 4 frames ?? (here is the dump)
ffprobe version 4.1.3 Copyright (c) 2007-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
{
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:04.00, start: 0.000000, bitrate: 4 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 100x100, 2 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc (default)
Metadata:
handler_name : VideoHandler
"frames": [
{
"media_type": "video",
"stream_index": 0,
"key_frame": 1,
"pkt_pts": 0,
"pkt_pts_time": "0.000000",
"pkt_dts": 0,
"pkt_dts_time": "0.000000",
"best_effort_timestamp": 0,
"best_effort_timestamp_time": "0.000000",
"pkt_duration": 16384,
"pkt_duration_time": "1.000000",
"pkt_pos": "48",
"pkt_size": "857",
"width": 100,
"height": 100,
"pix_fmt": "yuv444p",
"pict_type": "I",
"coded_picture_number": 0,
"display_picture_number": 0,
"interlaced_frame": 0,
"top_field_first": 0,
"repeat_pict": 0,
"chroma_location": "left"
},
{
"media_type": "video",
"stream_index": 0,
"key_frame": 0,
"pkt_pts": 16384,
"pkt_pts_time": "1.000000",
"pkt_dts": 16384,
"pkt_dts_time": "1.000000",
"best_effort_timestamp": 16384,
"best_effort_timestamp_time": "1.000000",
"pkt_duration": 16384,
"pkt_duration_time": "1.000000",
"pkt_pos": "1053",
"pkt_size": "146",
"width": 100,
"height": 100,
"pix_fmt": "yuv444p",
"pict_type": "B",
"coded_picture_number": 2,
"display_picture_number": 0,
"interlaced_frame": 0,
"top_field_first": 0,
"repeat_pict": 0,
"chroma_location": "left"
},
{
"media_type": "video",
"stream_index": 0,
"key_frame": 0,
"pkt_pts": 32768,
"pkt_pts_time": "2.000000",
"best_effort_timestamp": 32768,
"best_effort_timestamp_time": "2.000000",
"pkt_duration": 16384,
"pkt_duration_time": "1.000000",
"pkt_pos": "1199",
"pkt_size": "19",
"width": 100,
"height": 100,
"pix_fmt": "yuv444p",
"pict_type": "B",
"coded_picture_number": 3,
"display_picture_number": 0,
"interlaced_frame": 0,
"top_field_first": 0,
"repeat_pict": 0,
"chroma_location": "left"
},
{
"media_type": "video",
"stream_index": 0,
"key_frame": 0,
"pkt_pts": 49152,
"pkt_pts_time": "3.000000",
"best_effort_timestamp": 49152,
"best_effort_timestamp_time": "3.000000",
"pkt_duration": 16384,
"pkt_duration_time": "1.000000",
"pkt_pos": "905",
"pkt_size": "148",
"width": 100,
"height": 100,
"pix_fmt": "yuv444p",
"pict_type": "P",
"coded_picture_number": 1,
"display_picture_number": 0,
"interlaced_frame": 0,
"top_field_first": 0,
"repeat_pict": 0,
"chroma_location": "left"
}
]
}I tried different things, and everything seems to work fine if i split a 2 second video (still 1 fps) up and concat again. But something goes wrong when going beyond that ?
Here is output from
ffmpeg -i fps.mp4
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'scripts/fps.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:03.00, start: 0.000000, bitrate: 7 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 100x100, 4 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc (default)
Metadata:
handler_name : VideoHandler