
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (17)
-
Les images
15 mai 2013 -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)
Sur d’autres sites (4846)
-
Revision 6c280c2299 : Adjust style to match Google Coding Style a little more closely. Most of these
1er novembre 2012, par Ronald S. BultjeChanged Paths : Modify /vp8/common/arm/arm_systemdependent.c Modify /vp8/common/debugmodes.c Modify /vp8/common/entropymode.c Modify /vp8/common/entropymode.h Modify /vp8/common/extend.c Modify /vp8/common/extend.h Modify /vp8/common/filter.c (...)
-
How to load font in ffmpeg through google font [duplicate]
21 octobre 2020, par Konduri Sai Adityahow to load font file in FFmpeg through web google font ?. I tried to use google font in the cmd, but it seems telling that no web font found. can anyone tell me whether we can load font through google font URL


ffmpeg -i test.png -i sample1.mp4 -y -filter_complex "[1:v]scale=1230:692[scale1];[scale1]rotate=0:c=black@0:ow=rotw(0):oh=roth(0)[rotate0];[0:v][rotate0]overlay=333.61:172.85[mediaoverlayout0];color=black@0:959x137[c1];[c1]setsar=1,drawtext=fontfile='http://fonts.gstatic.com/s/opensans/v18/mem8YaGs126MiZpBA-U1UpcaXcl0Aw.ttf':text='Double click to edit':fontsize=121.19999999999999:fontcolor=#1e8bc3:line_spacing=16.916000000000007,rotate=0:ow=rotw(0):oh=roth(0):c=black@0[rottext1];[mediaoverlayout0][rottext1]overlay=x=207.52:y=271.076:shortest=1" -pix_fmt yuv420p -t 10 ok1.mp4 



Below are logs


built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndi
o --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-lib
ass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --e
nable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-l
ibvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable
-libzimg
 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
 libswscale 5. 3.100 / 5. 3.100
 libswresample 3. 3.100 / 3. 3.100
 libpostproc 55. 3.100 / 55. 3.100
Input #0, png_pipe, from 'storage/test.png':
 Duration: N/A, bitrate: N/A
 Stream #0:0: Video: png, 1 reference frame, rgba(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
[h264 @ 0x59749c0] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'storage/sample1.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.17.101
 Duration: 00:00:08.12, start: 0.000000, bitrate: 820 kb/s
 Stream #1:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088), 578 kb/s, 25 fps, 25 
tbr, 12800 tbn, 50 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
 Metadata:
 handler_name : #Mainconcept MP4 Sound Media Handler
-y: No such file or directory
[AVIOContext @ 0x597a480] Statistics: 10601 bytes read, 0 seeks
[AVIOContext @ 0x597a040] Statistics: 156922 bytes read, 2 seeks



-
Screen Capture with FFMPEG and Google Native Client
18 juillet 2016, par Mohammad Abu MusaI am building a screen recorder that is based on Native Client for Google, I have ffmpeg installed and ready but I do not have experience programming in ffmpeg. so I am looking for tips to understand how to build this recorder.
My goal is to make a screen recorder and export videos as webm files, I have all the required libraries I just could not find any code examples to hack on
This is what I achieved so far
#define __STDC_LIMIT_MACROS
#include
#include <iostream>
#include
#include
#include <sstream>
#include
#include <vector>
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/var_dictionary.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_console.h"
#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/var.h"
#include "ppapi/cpp/var_array_buffer.h"
// Begin File IO headers
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/cpp/directory_entry.h"
#include "ppapi/cpp/file_io.h"
#include "ppapi/cpp/file_ref.h"
#include "ppapi/cpp/file_system.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/message_loop.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/var.h"
#include "ppapi/cpp/var_array.h"
#include "ppapi/utility/completion_callback_factory.h"
#include "ppapi/utility/threading/simple_thread.h"
#ifndef INT32_MAX
#define INT32_MAX (0x7FFFFFFF)
#endif
#ifdef WIN32
#undef min
#undef max
#undef PostMessage
// Allow 'this' in initializer list
#pragma warning(disable : 4355)
#endif
namespace {
typedef std::vector StringVector;
}
//End File IO headers
extern "C" {
#include <libavcodec></libavcodec>avcodec.h>
#include <libswscale></libswscale>swscale.h>
#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>imgutils.h>
}
const char* file_name = "/file.txt";
const char* video_name = "/video.mpeg";
const char* file_text = "Echo from NaCl: ";
/**
* Pixel formats and codecs
*/
static const AVPixelFormat sourcePixelFormat = AV_PIX_FMT_BGR24;
static const AVPixelFormat destPixelFormat = AV_PIX_FMT_YUV420P;
static const AVCodecID destCodec = AV_CODEC_ID_MPEG2VIDEO;
class RecorderInstance: public pp::Instance {
public:
explicit RecorderInstance(PP_Instance instance) :
pp::Instance(instance), callback_factory_(this), file_system_(this,
PP_FILESYSTEMTYPE_LOCALPERSISTENT), file_system_ready_(
false), file_thread_(this) {
}
virtual ~RecorderInstance() {
file_thread_.Join();
}
virtual bool Init(uint32_t /*argc*/, const char * /*argn*/[],
const char * /*argv*/[]) {
file_thread_.Start();
file_thread_.message_loop().PostWork(
callback_factory_.NewCallback(
&RecorderInstance::OpenFileSystem));
avcodec_register_all(); // mandatory to register ffmpeg functions
return true;
}
private:
pp::CompletionCallbackFactory<recorderinstance> callback_factory_;
pp::FileSystem file_system_;
// Indicates whether file_system_ was opened successfully. We only read/write
// this on the file_thread_.
bool file_system_ready_;
pp::SimpleThread file_thread_;
virtual void HandleMessage(const pp::Var& var_message) {
if (!var_message.is_dictionary()) {
LogToConsole(PP_LOGLEVEL_ERROR, pp::Var("Invalid message!"));
return;
}
pp::VarDictionary dict_message(var_message);
std::string command = dict_message.Get("message").AsString();
if (command == "sendFrame") {
pp::VarArrayBuffer data(dict_message.Get("data"));
uint width = 600;
uint height = 800;
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
/**
* Create an encoder and open it
*/
avcodec_register_all();
AVCodec *h264encoder = avcodec_find_encoder(destCodec);
AVCodecContext *h264encoderContext = avcodec_alloc_context3(
h264encoder);
h264encoderContext->pix_fmt = destPixelFormat;
h264encoderContext->width = width;
h264encoderContext->height = height;
if (avcodec_open2(h264encoderContext, h264encoder, NULL) < 0) {
ShowErrorMessage("Cannot open codec" ,-1);
return;
}
/**
* Create a stream
*/
AVFormatContext *cv2avFormatContext = avformat_alloc_context();
AVStream *h264outputstream = avformat_new_stream(cv2avFormatContext,
h264encoder);
AVFrame *sourceAvFrame = av_frame_alloc(), *destAvFrame =
av_frame_alloc();
int got_frame;
FILE* videoOutFile = fopen("video", "wb");
/**
* Prepare the conversion context
*/
SwsContext *bgr2yuvcontext = sws_getContext(width, height,
sourcePixelFormat, width, height, destPixelFormat,
SWS_BICUBIC, NULL, NULL, NULL);
int framesToEncode = 100;
/**
* Convert and encode frames
*/
for (uint i = 0; i < framesToEncode; i++) {
/**
* Allocate source frame, i.e. input to sws_scale()
*/
av_image_alloc(sourceAvFrame->data, sourceAvFrame->linesize,
width, height, sourcePixelFormat, 1);
/**
* Copy image data into AVFrame from cv::Mat
*/
for (uint32_t h = 0; h < height; h++)
memcpy(
&(sourceAvFrame->data[0][h
* sourceAvFrame->linesize[0]]),
&(data), width * 3);
/**
* Allocate destination frame, i.e. output from sws_scale()
*/
av_image_alloc(destAvFrame->data, destAvFrame->linesize, width,
height, destPixelFormat, 1);
sws_scale(bgr2yuvcontext, sourceAvFrame->data,
sourceAvFrame->linesize, 0, height, destAvFrame->data,
destAvFrame->linesize);
sws_freeContext(bgr2yuvcontext);
/**
* Prepare an AVPacket and set buffer to NULL so that it'll be allocated by FFmpeg
*/
AVPacket avEncodedPacket;
av_init_packet(&avEncodedPacket);
avEncodedPacket.data = NULL;
avEncodedPacket.size = 0;
destAvFrame->pts = i;
avcodec_encode_video2(h264encoderContext, &avEncodedPacket,
destAvFrame, &got_frame);
if (got_frame) {
ShowErrorMessage(
"Encoded a frame of size \n",-1); //+ (string)avEncodedPacket.size + "\n");
if (fwrite(avEncodedPacket.data, 1, avEncodedPacket.size,
videoOutFile) < (unsigned) avEncodedPacket.size)
ShowErrorMessage(
"Could not write all \n",-1);
//+ avEncodedPacket.size
//+ " bytes, but will continue..\n"
fflush(videoOutFile);
}
/**
* Per-frame cleanup
*/
av_packet_free_side_data(&avEncodedPacket);
av_free_packet(&avEncodedPacket);
av_freep(sourceAvFrame->data);
av_frame_free(&sourceAvFrame);
av_freep(destAvFrame->data);
av_frame_free(&destAvFrame);
}
fwrite(endcode, 1, sizeof(endcode), videoOutFile);
fclose(videoOutFile);
/**
* Final cleanup
*/
avformat_free_context(cv2avFormatContext);
avcodec_close(h264encoderContext);
avcodec_free_context(&h264encoderContext);
} else if (command == "createFile") {
file_thread_.message_loop().PostWork(
callback_factory_.NewCallback(&RecorderInstance::Save,
file_name, file_text));
}
}
void OpenFileSystem(int32_t /* result */) {
int32_t rv = file_system_.Open(1024 * 1024, pp::BlockUntilComplete());
if (rv == PP_OK) {
file_system_ready_ = true;
// Notify the user interface that we're ready
ShowStatusMessage("STORAGE READY");
} else {
ShowErrorMessage("Failed to open file system", rv);
}
}
void Save(int32_t /* result */, const std::string& file_name,
const std::string& file_contents) {
if (!file_system_ready_) {
ShowErrorMessage("File system is not open", PP_ERROR_FAILED);
return;
}
pp::FileRef ref(file_system_, file_name.c_str());
pp::FileIO file(this);
int32_t open_result = file.Open(ref,
PP_FILEOPENFLAG_WRITE | PP_FILEOPENFLAG_CREATE
| PP_FILEOPENFLAG_TRUNCATE, pp::BlockUntilComplete());
if (open_result != PP_OK) {
ShowErrorMessage("File open for write failed", open_result);
return;
}
// We have truncated the file to 0 bytes. So we need only write if
// file_contents is non-empty.
if (!file_contents.empty()) {
if (file_contents.length() > INT32_MAX) {
ShowErrorMessage("File too big", PP_ERROR_FILETOOBIG);
return;
}
int64_t offset = 0;
int32_t bytes_written = 0;
do {
bytes_written = file.Write(offset,
file_contents.data() + offset, file_contents.length(),
pp::BlockUntilComplete());
if (bytes_written > 0) {
offset += bytes_written;
} else {
ShowErrorMessage("File write failed", bytes_written);
return;
}
} while (bytes_written
< static_cast(file_contents.length()));
}
// All bytes have been written, flush the write buffer to complete
int32_t flush_result = file.Flush(pp::BlockUntilComplete());
if (flush_result != PP_OK) {
ShowErrorMessage("File fail to flush", flush_result);
return;
}
ShowStatusMessage("Save success");
}
/// Encapsulates our simple javascript communication protocol
void ShowErrorMessage(const std::string& message, int32_t result) {
std::stringstream ss;
ss << "ERROR: " << message << " -- Error #: " << result << "\n";
PostMessage(ss.str());
}
void ShowStatusMessage(const std::string& message) {
std::stringstream ss;
ss << "LOG: " << message << "\n";
PostMessage(ss.str());
}
};
class RecorderModule: public pp::Module {
public:
RecorderModule() :
pp::Module() {
}
virtual ~RecorderModule() {
}
virtual pp::Instance* CreateInstance(PP_Instance instance) {
return new RecorderInstance(instance);
}
};
namespace pp {
/**
* This function is an entry point to a NaCl application.
* It must be implemented.
*/
Module* CreateModule() {
return new RecorderModule();
}
} // namespace pp
</recorderinstance></vector></sstream></iostream>