
Recherche avancée
Autres articles (112)
-
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 ;
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (10067)
-
FFMPEG avformat_open_input returning AVERROR_INVALIDDATA [on hold]
10 août 2016, par Victor.dMdBI’m trying to use ffmpeg to take in video data from a buffer but keep on getting the same error.
I’ve implemented the same code as described here :
http://www.ffmpeg.org/doxygen/trunk/doc_2examples_2avio_reading_8c-example.htmlHere is the code (I’ve tried removing the unnecessary bits)
VideoInputFile *video_input_file;
VideoDataConf *video_data_conf;
video_data_conf->width = 1920;
video_data_conf->height = 1080;
int vbuf_size = 9 * cmd_data_ptr->video_data_conf.width * cmd_data_ptr->video_data_conf.height + 10000;
uint8_t *buffer = (uint8_t *) av_malloc(vbuf_size);
video_data_conf->input_ptr.ptr = buffer;
video_data_conf->input_ptr.size = vbuf_size;
strncpy(video_data_conf->filename, "localmem");
video_input_file->vbuf_size = 9 * video_data_conf->width * video_data_conf->height + 10000;
video_input_file->vbuf = (uint8_t *) av_malloc(video_input_file->vbuf_size);
video_input_file->av_io_ctx = avio_alloc_context(video_input_file->vbuf, video_input_file->vbuf_size, 0, &video_data_conf->input_ptr, &read_function, NULL, NULL);
if ( !video_input_file->av_io_ctx ) {
fprintf(stdout,"Failed to create the buffer avio context\n");
}
video_input_file->av_fmt_ctx = avformat_alloc_context();
if ( !video_input_file->av_fmt_ctx ) {
printf(stdout,"Failed to create the video avio context\n");
}
video_input_file->av_fmt_ctx->pb = video_input_file->av_io_ctx;
open_res = avformat_open_input(&video_input_file->av_fmt_ctx, video_data_conf->filename, NULL, NULL);Read function :
static int read_function(void* opaque, uint8_t* buf, int buf_size) {
BufferData *bd = (BufferData *) opaque;
buf_size = FFMIN(buf_size, bd->size);
memcpy(buf, bd->ptr, buf_size);
bd->ptr += buf_size;
bd->size -= buf_size;
return buf_size;
}BufferData structure
typedef struct {
uint8_t *ptr;
size_t size; ///< size left in the buffer
} BufferData;It starts to work if I initialise the buffer and vbuf_size with a real file like so :
uint8_t *buffer;
size_t vbuf_size;
av_file_map("/path/to/image.png", &buffer, &vbuf_size, 0, NULL); -
libvlc ffmpeg : No seek in mpegts h264 stream
26 juillet 2016, par ElDoradoI am using ffmpeg to record video input from GDI (windows screen recorder) to view it later using VLC (via ActiveX plugin) + ffmpeg to decode it.
Right now seeking in video is not working in VLC via plugin (which is critical). VLC player itself provide seeking, but it is more like byte position seeking (on I- frames which are larger than other frames it makes larger steps on horizontal scroll and also there are no timestamps).
Encoder is opened with next defaults :
avformat_alloc_output_context2(&outputContext, NULL, "mpegts", "test.mpg");
outputFormat = outputContext->oformat;
encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
outputStream = avformat_new_stream(outputContext, encoder);
outputStream->id = outputContext->nb_streams - 1;
encoderContext = outputStream->codec;
encoderContext->bit_rate = bitrate; // 800000 by default
encoderContext->rc_max_rate = bitrate;
encoderContext->width = imageWidth; // 1920
encoderContext->height = imageHeight; // 1080
encoderContext->time_base.num = 1;
encoderContext->time_base.den = fps; // 25 by default
encoderContext->gop_size = fps;
encoderContext->keyint_min = fps;
encoderContext->max_b_frames = 0;
encoderContext->pix_fmt = AV_PIX_FMT_YUV420P;
outputStream->time_base = encoderContext->time_base;
avcodec_open2(encoderContext, encoder, NULL);Recording is done this way :
// my impl of GDI recorder, returning AVFrame with only data and linesize filled.
AVFrame* tmp_frame = impl_->recorder->acquireFrame();
// converting RGB -> YUV420
sws_scale(impl_->scaleContext, tmp_frame->data, tmp_frame->linesize, 0, impl_->frame->height, impl_->frame->data, impl_->frame->linesize);
// pts variable is calculated by using QueryPerformanceCounter form WinAPI. It is strictly increasing
impl_->frame->pts = pts;
avcodec_encode_video2(impl_->encoderContext, impl_->packet, impl_->frame, &out_size);
if (out_size) {
impl_->packet->pts = pts;
impl_->packet->dts = pts;
impl_->packet->duration = 1; // here it is! It is set but has no effect
av_packet_rescale_ts(impl_->packet, impl_->encoderContext->time_base, impl_->outputStream->time_base);
// here pts = 3600*pts, dts = 3600*pts, duration = 3600 what I consider to be legit in terms of milliseconds
impl_->packet->stream_index = impl_->outputStream->index;
av_interleaved_write_frame(impl_->outputContext, impl_->packet);
av_packet_unref(impl_->packet);
out_size = 0;
}ffprobe is providing next info on frames :
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=3600
pkt_pts_time=0:00:00.040000
pkt_dts=3600
pkt_dts_time=0:00:00.040000
best_effort_timestamp=3600
best_effort_timestamp_time=0:00:00.040000
pkt_duration=N/A
pkt_duration_time=N/A
pkt_pos=564
pkt_size=97.018555 Kibyte
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]I believe that problem is in
pkt_duration
variable, though it was set.
What I am doing wrong in recording so I can’t seek in video ?P.S. on other videos (also h264) seeking is working in ActiveX VLC plugin.
-
Add padding with ffmpeg to videos increases file size, why ?
12 mars 2023, par try2getsmarterI need to add padding to mp4 video files (since tv changes aspect ratio on playback) and I simply can do this with -pad option of ffmpeg.


The output is ok for me, but I see that most of the video files increase about 25%-30% in file size.


ffmpeg -i in.mp4 -preset slow -vf "pad=1920:1080 :(1920-iwmin(1920/iw,1080/ih))/2 :(1080-ihmin(1920/iw,1080/ih))/2" -c:v h264 -c:a copy out_fhd.mp4"


Is there a way to preserve the input quality and have the same file size ? As the black bars contain no information I had the expectation that there is a lossless mode to take the already H264 encoded stream and just add blocks with black pixels.