
Recherche avancée
Médias (1)
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (75)
-
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)
Sur d’autres sites (10334)
-
ffmpeg-php loading videos but not generating jpeg (thumbnails)
16 mars 2021, par Ali HamdarThe website is now running on :
finlandbooking.online


Sorry for this noob question first of all.
This is a social media script, when you upload a video, it shows a black thumbnail - you can play the video, but the thumbnail is black. I checked the issue with developers tools, it seems that it's showing error 404 - image not found. ffmpeg, as far as I understood, is supposed to generate an image and display it as a thumbnail. The image is supposed to be located in /uploads/images/ - Kindly check this part of the code and let me know why it's not working :


else if ($action == 'upload_post_video') {
if (empty($cl["is_logged"])) {
 $data['status'] = 400;
 $data['error'] = 'Invalid access token';
}
else {
 $data['err_code'] = "invalid_req_data";
 $data['status'] = 400;
 $post_data = $me['draft_post'];

 if (not_empty($_FILES['video']) && not_empty($_FILES['video']['tmp_name'])) {
 if (empty($post_data)) {
 $post_id = cl_create_orphan_post($me['id'], "video");
 $post_data = cl_get_orphan_post($post_id);

 cl_update_user_data($me['id'],array(
 'last_post' => $post_id
 ));
 }

 if (not_empty($post_data) && $post_data["type"] == "video") {
 if (empty($post_data['media'])) {
 $file_info = array(
 'file' => $_FILES['video']['tmp_name'],
 'size' => $_FILES['video']['size'],
 'name' => $_FILES['video']['name'],
 'type' => $_FILES['video']['type'],
 'file_type' => 'video',
 'folder' => 'videos',
 'slug' => 'original',
 'allowed' => 'mp4,mov,3gp,webm',
 );

 $file_upload = cl_upload($file_info);
 $upload_fail = false;
 $post_id = $post_data['id'];

 if (not_empty($file_upload['filename'])) {
 try {
 require_once(cl_full_path("core/libs/ffmpeg-php/vendor/autoload.php"));

 $ffmpeg = new FFmpeg(cl_full_path($config['ffmpeg_binary']));
 $thumb_path = cl_gen_path(array(
 "folder" => "images",
 "file_ext" => "jpeg",
 "file_type" => "image",
 "slug" => "poster",
 ));

 $ffmpeg->input($file_upload['filename']);
 $ffmpeg->set('-ss','3');
 $ffmpeg->set('-vframes','1');
 $ffmpeg->set('-f','mjpeg');
 $ffmpeg->output($thumb_path)->ready();
 } 

 catch (Exception $e) {
 $upload_fail = true;
 }

 if (empty($upload_fail)) {
 $img_id = $db->insert(T_PUBMEDIA, array(
 "pub_id" => $post_id,
 "type" => "video",
 "src" => $file_upload['filename'],
 "time" => time(),
 "json_data" => json(array(
 "poster_thumb" => $thumb_path
 ),true)
 ));

 if (is_posnum($img_id)) {
 $data['status'] = 200;
 $data['video'] = array(
 "source" => cl_get_media($file_upload['filename']),
 "poster" => cl_get_media($thumb_path),
 );
 }
 }
 }
 }
 else {
 $data['err_code'] = "total_limit_exceeded";
 $data['status'] = 400;
 }
 }
 else {
 cl_delete_orphan_posts($me['id']);
 cl_update_user_data($me['id'],array(
 'last_post' => 0
 ));
 }
 }
}



}


-
Muting ffmpeg warnings when loading video with OpenCV
26 mai 2017, par cbuchartI’m using OpenCV to process a set of MPEG videos. For some of them following warning is displayed when reading a frame or seeking (it is printed by the ffmpeg library).
[mpeg2video @ 026b0d20] warning : first frame is no keyframe
The thing is that such messages are printed together other valid output of my application and they are bothering final users. Is there any way to suppress such warning messages programmatically, other than re-coding the videos with an external tool ?
I’m already muting the standard output and error, as well as using a custom (dummy) OpenCV error handler. Below a MCVE for testing.
PS : I understand the warning and actually the full project handles those scenarios so videos are correctly read.
Example code to reproduce the problem
#include <iostream>
#include <opencv2></opencv2>core/core.hpp>
#include <opencv2></opencv2>highgui/highgui.hpp>
int handleError(int status, const char* func_name,
const char* err_msg, const char* file_name,
int line, void* userdata)
{
return 0;
}
int main()
{
std::cout << "Start!" << std::endl;
cv::VideoCapture reader;
if (!reader.open("Sample.mpg")) {
std::cout << "Failed opening video" << std::endl;
return 0;
}
cv::redirectError(handleError);
std::cout.setstate(std::ios_base::failbit);
std::cout << "std::cout mute test..." << std::endl; // OK, muted
std::cerr.setstate(std::ios_base::failbit);
std::cerr << "std::cerr mute test..." << std::endl; // OK, muted
cv::Mat tmpImage;
try {
tmpImage = tmpImage * tmpImage; // OK, OpenCV error muted
} catch (...) {}
// Here the warning is printed
reader.read(tmpImage);
std::cout.clear();
std::cerr.clear();
std::cout << "Finished!" << std::endl;
return 0;
}
</iostream>The
Sample.mpg
video can be downloaded from the Internet Archive : https://archive.org/download/ligouHDR-HC1_sample1/Sample.mpgThis is the current output of the program :
I’m using VS 2010 and OpenCV 2.4.10. Following DLLs are the only ones with the executable (no other OpenCV-related DLL is reachable in the PATH).
- opencv_core2410.dll
- opencv_ffmpeg2410.dll
- opencv_highgui2410.dll
-
VideoCapture always returns False in Python OPENCV [Linux]
7 avril 2017, par Daniyal ShahrokhianEvery time that I use VideoCapture trying to access the frames from a video file, the return value (
ret
) is false. See the sample code below :cap = cv2.VideoCapture('asd.mkv')
vid = []
while True:
ret, img = cap.read()
if not ret: # Always happens
break
vid.append(cv2.resize(img, (171, 128)))I have already tried absolutely everything I could find today by googling, including the OpenCV guide and this long issue on Github. Also, I read some solutions involving moving ffmpeg dll files, but that only was in the case of Windows.
Any ideas ? Because I defenitely ran out of them.