
Recherche avancée
Autres articles (103)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Formulaire personnalisable
21 juin 2013, parCette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire. (...) -
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. (...)
Sur d’autres sites (3852)
-
avformat/aviobuf : Avoid calling function twice due to FFMAX()
4 août 2021, par Andreas Rheinhardt -
What is the correct way to write Frames in ffmpeg
6 février 2020, par hagorI am working on some ffmpeg writer implementation and I can not undrestand what do I do wrong.
I have a mdf (media digital file) file which I need to convert to avi and I have a software that does it. The test case : Avi file I get from my software and avi file I get from software are identical.
I can get frames from input mdf file, and can convert them to bmps correctly. So I suppose I do something wrong with ffmpeg.
I also need to use raw RGB codec in ffmpeg.Here is the code I wrote to fill avi files with frames :
if (hOffLoaderDVR && m_hDeviceCollection && device && hDriveSetDVR && hFile)
{
std::string camSuffix = "_cam_";
std::string cameraName = hFile->streamByIndex(streamC)->cameraPortName().c_str();
std::string fileName = pathToAviDir + hFile->parameters()->name.c_str() + camSuffix + cameraName + std::to_string(streamC).c_str() + ".avi";
Offload::Request request;
Common::DataTypeHandle cameraParams = hFile->streamByIndex(streamC)->streamView()->dataType();
AVFrame* frame = m_ffwriter.alloc_picture(AV_PIX_FMT_BGR24, cameraParams->width(), cameraParams->height());
size_t datasize = hFile->streamByIndex(streamC)->streamView()->frameAtIndex(0)->buffer()->size(); // size in bytes
RecordingParams params(fileName, cameraParams->width(), cameraParams->height(), 50,
AV_PIX_FMT_BGR24, datasize);
frame->pkt_size = datasize;
m_ffwriter.delayedOpen(params);
for (unsigned int frameC = 0; frameC < hFile->streamByIndex(streamC)->streamView()->frameCount(); frameC++)
{
m_ffwriter.fill_rgb_image(frame, hFile->streamByIndex(streamC)->streamView()->frameAtIndex(frameC)->buffer()->data());
m_ffwriter.putImage(frame);
}
m_ffwriter.close();
av_frame_free(&frame);
}To open the AVI file I use the function ffmpegWriter::delayedOpen :
bool FfmpegWriter::delayedOpen(const RecordingParams & params) {
unsigned int w = params.getWidth();
unsigned int h = params.getHeight();
unsigned int framerate = params.getFramerate();
unsigned int datasize = params.getDataSize();
m_filename = params.getPath();
unsigned int sample_rate = 0; //default
unsigned int channels = 0; //default
m_delayed = false;
if (w <= 0 || h <= 0) {
m_delayed = true;
return true;
}
m_ready = true;
// auto detect the output format from the name. default is mpeg.
m_fmt = av_guess_format(nullptr, m_filename.c_str(), nullptr);
m_fmt->video_codec = AV_CODEC_ID_RAWVIDEO; //can be moved to a parameter if required
if (!m_fmt) {
printf("Could not deduce output format from file extension: using MPEG.\n");
m_fmt = av_guess_format("mpeg", nullptr, nullptr);
}
if (!m_fmt) {
fprintf(stderr, "Could not find suitable output format\n");
::exit(1);
}
// allocate the output media context
m_oc = avformat_alloc_context();
if (!m_oc) {
fprintf(stderr, "Memory error\n");
::exit(1);
}
m_oc->oformat = m_fmt;
m_fmt->flags = AVFMT_NOTIMESTAMPS;
snprintf(m_oc->filename, sizeof(m_oc->filename), "%s", m_filename.c_str());
// add the audio and video streams using the default format codecs
// and initialize the codecs
m_video_st = nullptr;
m_audio_st = nullptr;
if (m_fmt->video_codec != AV_CODEC_ID_NONE) {
m_video_st = add_video_stream(m_oc, m_fmt->video_codec, w, h, framerate);
}
av_dump_format(m_oc, 0, m_filename.c_str(), 1);
// now that all the parameters are set, we can open
// video codecs and allocate the necessary encode buffers
if (m_video_st) {
open_video(m_oc, m_video_st, datasize);
}
// open the output file, if needed
if (!(m_fmt->flags & AVFMT_NOFILE)) {
if (avio_open(&m_oc->pb, m_filename.c_str(), AVIO_FLAG_WRITE) < 0) {
fprintf(stderr, "Could not open '%s'\n", m_filename.c_str());
::exit(1);
}
}
// write the stream header, if any
avformat_write_header(m_oc, NULL);
return true;
}And to fill images and put them into the AVI I use these functions :
void FfmpegWriter::fill_rgb_image(AVFrame *pict, void *p)
{
memcpy(pict->data[0], p, pict->pkt_size);
}
bool FfmpegWriter::putImage(AVFrame * newFrame) {
if (m_delayed) {
// savedConfig.put("width",Value((int)image.width()));
// savedConfig.put("height",Value((int)image.height()));
}
if (!isOk()) {
return false;
}
if (m_video_st) {
m_video_pts = (double)av_stream_get_end_pts(m_video_st) *m_video_st->time_base.num / m_video_st->time_base.den;
}
else {
m_video_pts = 0.0;
}
if (!(m_video_st)) {
return false;
}
// write interleaved video frame
write_video_frame(m_oc, m_video_st, newFrame);
return true;
}Do I not open context correctly ? Or where might be the problem ? The problems I can see are that the output AVI has around minute delay in the beginning with no frames changing, and the video channels behave differently(it seems that red and blue dissapeared). Does it make any difference to use other format ? I currently use AV_PIX_FMT_BGR24 which seems to be correct (I can visualize frames from the same pointer correctly).
Thank you for your help !
-
avformat/matroskadec : Read RealAudio extradata directly
4 août 2021, par Andreas Rheinhardt