
Recherche avancée
Autres articles (44)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (8941)
-
ffmpeg : avcodec_open2 returns invalid argument
12 mai 2016, par roarii’m reusing the sample code from the developer 64bit release of ffmpeg in my application to encode a video :
AVCodec* pCodec_{nullptr};
AVCodecContext* pContext_{nullptr};
avcodec_register_all();
pCodec_ = avcodec_find_encoder(AV_CODEC_ID_MPEG2VIDEO);
if (!pCodec_) {}
pContext_ = avcodec_alloc_context3(pCodec_);
if (!pContext_) {}
pContext_->bit_rate = 400000;
pContext_->width = size.width();
pContext_->height = size.height();
pContext_->time_base.den = 1;
pContext_->time_base.num = fps;
pContext_->gop_size = 10;
pContext_->max_b_frames = 1;
pContext_->pix_fmt = AV_PIX_FMT_BGR0;
if (codec_id == AV_CODEC_ID_H264) {
av_opt_set(pContext_->priv_data, "preset", "slow", 0);
}
int err = avcodec_open2(pContext_, pCodec_, nullptr);
if (err < 0) {}AVCodec* and AVCodecContext* look like they are allocated correctly. avcodec_open2 then returns invalid argument (-22).
I use : Windows 10 64, VS2013 Compiler, Qt Creator IDE, ffmpeg(2016-05-12) 64bit.
The sample i took the code from is "decoding_encoding.c".
Any ideas ?
-
Wrong second count for blackdetect filter in ffprobe
10 avril 2016, par JabbI issue this command on a 8 minutes 20 seconds video in order to detect blackframes.
root@ubuntu:/home/hts# ffprobe -f lavfi -i "movie=test.ts,blackdetect[out0]" -show_entries tags=lavfi.black_start,lavfi.black_end -of default=nw=1
I am expecting to get proper seconds back from ffprobe indicating where the blackframes are.
Instead I receive very very high numbers.
I need to mention that I cut this video from the end of a larger stream using tail. The stream is configured to add a keyframe every 0.5 seconds. Could this be the reason ? And how could I cope with this ?
ffprobe version git-2016-03-31-54ccaae Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-libmfx
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 33.100 / 57. 33.100
libavformat 57. 29.101 / 57. 29.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 40.102 / 6. 40.102
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
[h264 @ 0x3222100] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x3222100] decode_slice_header error
[h264 @ 0x3222100] no frame!
Input #0, lavfi, from 'movie=test.ts,blackdetect[out0]':
Duration: N/A, start: 78576.400000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x256 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 90k tbn, 90k tbc
TAG:lavfi.black_start=78681.9
TAG:lavfi.black_end=78682
TAG:lavfi.black_start=78720.5
TAG:lavfi.black_end=78721.1
TAG:lavfi.black_start=78761.4
TAG:lavfi.black_end=78762.6
TAG:lavfi.black_start=78770.9
TAG:lavfi.black_end=78771
TAG:lavfi.black_start=78781
TAG:lavfi.black_end=78781.2
TAG:lavfi.black_start=78801.2
TAG:lavfi.black_end=78801.4
TAG:lavfi.black_start=78821.4
TAG:lavfi.black_end=78821.5
TAG:lavfi.black_start=78851.5
TAG:lavfi.black_end=78851.7
TAG:lavfi.black_start=78871.7
TAG:lavfi.black_end=78871.8
TAG:lavfi.black_start=78891.8
TAG:lavfi.black_end=78892
TAG:lavfi.black_start=78919
TAG:lavfi.black_end=78919.2
TAG:lavfi.black_start=78949.2
TAG:lavfi.black_end=78949.3
TAG:lavfi.black_start=78979.3
TAG:lavfi.black_end=78979.5
TAG:lavfi.black_start=78999.5
TAG:lavfi.black_end=78999.6
TAG:lavfi.black_start=79022.6
TAG:lavfi.black_end=79022.8
TAG:lavfi.black_start=79042.8
TAG:lavfi.black_end=79043
TAG:lavfi.black_start=79063
TAG:lavfi.black_end=79063.1
[h264 @ 0x3260360] concealing 284 DC, 284 AC, 284 MV errors in P frame -
Encode video with FFmpeg fps have been wrong
7 novembre 2016, par Burak HamuryenI’m trying to encod a video with FFmpeg but i have a problem about fps.
So i build the sample code as followsAVCodec *codec;
AVCodecContext *c = NULL;
int i, ret, x, y, got_output;
FILE *f;
AVFrame *frame;
AVPacket pkt;
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
printf("Encode video file %s\n", filename);
/* find the mpeg1 video encoder */
codec = avcodec_find_encoder((AVCodecID)codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
exit(1);
}
c = avcodec_alloc_context3(codec);
if (!c) {
fprintf(stderr, "Could not allocate video codec context\n");
exit(1);
}
/* put sample parameters */
c->bit_rate = 400000;
/* resolution must be a multiple of two */
c->width = 352;
c->height = 288;
/* frames per second */
c->time_base.num = 1;
c->time_base.den = 5; //changed
/* emit one intra frame every ten frames
* check frame pict_type before passing frame
* to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
* then gop_size is ignored and the output of encoder
* will always be I frame irrespective to gop_size
*/
c->gop_size = 10;
c->max_b_frames = 1;
c->pix_fmt = AV_PIX_FMT_YUV420P;
if (codec_id == AV_CODEC_ID_H264)
av_opt_set(c->priv_data, "preset", "slow", 0);
/* open it */
if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "Could not open codec\n");
exit(1);
}
f = fopen(filename, "wb");
if (!f) {
fprintf(stderr, "Could not open %s\n", filename);
exit(1);
}
frame = av_frame_alloc();
if (!frame) {
fprintf(stderr, "Could not allocate video frame\n");
exit(1);
}
frame->format = c->pix_fmt;
frame->width = c->width;
frame->height = c->height;
/* the image can be allocated by any means and av_image_alloc() is
* just the most convenient way if av_malloc() is to be used */
ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height,
c->pix_fmt, 32);
if (ret < 0) {
fprintf(stderr, "Could not allocate raw picture buffer\n");
exit(1);
}
/* encode 5 second of video */
for (i = 0; i < 25; i++) {
av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
fflush(stdout);
/* prepare a dummy image */
/* Y */
for (y = 0; y < c->height; y++) {
for (x = 0; x < c->width; x++) {
frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
}
}
/* Cb and Cr */
for (y = 0; y < c->height / 2; y++) {
for (x = 0; x < c->width / 2; x++) {
frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
}
}
frame->pts = i;
/* encode the image */
ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
printf("Write frame %3d (size=%5d)\n", i, pkt.size);
fwrite(pkt.data, 1, pkt.size, f);
av_free_packet(&pkt);
}
}
/* get the delayed frames */
for (got_output = 1; got_output; i++) {
fflush(stdout);
ret = avcodec_encode_video2(c, &pkt, NULL, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
printf("Write frame %3d (size=%5d)\n", i, pkt.size);
fwrite(pkt.data, 1, pkt.size, f);
av_free_packet(&pkt);
}
}
/* add sequence end code to have a real mpeg file */
fwrite(endcode, 1, sizeof(endcode), f);
fclose(f);
avcodec_close(c);
av_free(c);
av_freep(&frame->data[0]);
av_frame_free(&frame);
printf("\n");and I changed the following parts from the original
c->time_base.num = 1;
c->time_base.den = 5;after these changes, i expect a video to be composed of 5 seconds and 5 fps.
But when i play the output video file, the video ends in 1 2 seconds.
The ffprob output of output video is as follows.Edit :
ffprobe output added as a textffprobe version 2.0.1 Copyright (c) 2007-2013 the FFmpeg developers
built on Sep 26 2013 02:00:03 with gcc 4.8.1 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, h264, from 'C:\Users\bhamuryen\Desktop\Dev\Test\ffmpeg_test\ffmpeg_test\test.h264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 352x288, 5 fps, 5 tbr, 1200k tbn, 10 tbc
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/10
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=352
height=288
has_b_frames=1
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=yuv420p
level=13
timecode=N/A
id=N/A
r_frame_rate=10/2
avg_frame_rate=5/1
time_base=1/1200000
start_pts=N/A
start_time=N/A
duration_ts=N/A
duration=N/A
bit_rate=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0The output video file played with VLC and VLC statistic is as follows.
As shown, i setted fps 5 but vlc read it like 10 fps also ffprobe say to us
Stream #0:0 : Video : h264 (High), yuv420p, 352x288, 5 fps, 5 tbr, 1200k tbn, 10 tbc
and
codec_time_base=1/10
i think the important thing is codec_time_base=1/10 and 10 tbc.
What is wrong in this code ? i don’t know exactly the reason for the problem.
How can i create a video(5 fps -10 fps or custom fps) and play correctly the created video ?Thanks for your help.