
Recherche avancée
Médias (1)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (92)
-
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
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. -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (7475)
-
FFmpeg : generating H264 video in c++
13 octobre 2015, par EZEROFIVE EMDIm using ffmpeg library in windows with vs2012 to convert a series of images into Mp4 with H264 encoding. Im new to FFMPEG.
Below is my code. Everything went fine. Video is created.But i can play the video in vlc player only if i changed the extension to ".h264", also when i check for codec information it says "H264 - MPEG-4 AVC (part 10) (h264)". but when i checked the same for other mp4 videos which are downloaded from web. it says "H264 - MPEG-4" AVC (part 10) (avc1)". I dont understand where it went wrong. Also i searched a lot, some says like add SPS and PPS.
const uint8_t sps[] = { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00,
0x0a, 0xf8, 0x41, 0xa2 };
const uint8_t pps[] = { 0x00, 0x00, 0x00, 0x01, 0x68, 0xce,
0x38, 0x80 };So i added the above value to video file before i add the image stream. But no luck.
Can anyone help on this..Thanks in advance.const uint8_t sps[] = { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00,
0x0a, 0xf8, 0x41, 0xa2 };
const uint8_t pps[] = { 0x00, 0x00, 0x00, 0x01, 0x68, 0xce,
0x38, 0x80 };
const uint8_t slice_header[] = { 0x00, 0x00, 0x00, 0x01, 0x05, 0x88,
0x84, 0x21, 0xa0 };
const uint8_t macroblock_header[] = { 0x0d, 0x00 };
const uint8_t spspps[] = { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x0a, 0xf8, 0x41, 0xa2,
0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x38, 0x80
};
int ff_load_image(uint8_t *data[4], int linesize[4],
int *w, int *h, enum PixelFormat *pix_fmt,
const char *filename, void *log_ctx)
{
AVInputFormat *iformat = NULL;
AVFormatContext *format_ctx = NULL;
AVCodec *codec=NULL;
AVCodecContext *codec_ctx=NULL;
AVFrame *frame=NULL;
int frame_decoded, ret = 0;
AVPacket pkt;
av_register_all();
iformat = av_find_input_format("image2");
if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) {
return ret;
}
codec_ctx = format_ctx->streams[0]->codec;
codec = avcodec_find_decoder(codec_ctx->codec_id);
if (!codec) {
ret = AVERROR(EINVAL);
goto end;
}
if ((ret = avcodec_open2(codec_ctx, codec, NULL)) < 0) {
goto end;
}
//if (!(frame = avcodec_alloc_frame()) ) {
if (!(frame = av_frame_alloc()) ) {
ret = AVERROR(ENOMEM);
goto end;
}
ret = av_read_frame(format_ctx, &pkt);
if (ret < 0) {
goto end;
}
ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt);
if (ret < 0 || !frame_decoded) {
goto end;
}
ret = 0;
*w = frame->width;
*h = frame->height;
*pix_fmt = (PixelFormat)frame->format;
if ((ret = av_image_alloc(data, linesize, *w, *h, (AVPixelFormat)*pix_fmt, 16)) < 0)
goto end;
ret = 0;
av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, (AVPixelFormat)*pix_fmt, *w, *h);
end:
if(codec_ctx) { avcodec_close(codec_ctx); }
if(format_ctx) { avformat_close_input(&format_ctx); }
if(frame) { av_freep(&frame); }
av_free_packet(&pkt);
return ret;
}
int load_image_into_frame(AVFrame *frame, const char *filename)
{
int retval = -1, res;
static struct SwsContext *sws_ctx;
uint8_t *image_data[4];
int linesize[4];
int source_width, source_height;
enum PixelFormat source_fmt;
res = ff_load_image(image_data, linesize, &source_width, &source_height, &source_fmt, filename, NULL);
if (source_fmt != frame->format) {
sws_ctx = sws_getContext(source_width, source_height, (AVPixelFormat)source_fmt,
frame->width, frame->height, (AVPixelFormat)frame->format,
sws_flags, NULL, NULL, NULL);
sws_scale(sws_ctx,
(const uint8_t * const *)image_data, linesize,
0, frame->height, frame->data, frame->linesize);
}
retval = 0;
error:
av_freep(&image_data[0]);
sws_freeContext(sws_ctx);
return retval;
}
int write_frame_to_file(FILE *file, AVFrame *frame, AVCodecContext *codec_context, AVPacket *pkt) {
int res, got_output;
av_init_packet(pkt);
pkt->data = NULL;
pkt->size = 0;
/* generate synthetic video */
frame->pts += 30;
res = avcodec_encode_video2(codec_context, pkt, frame, &got_output);
if (got_output) {
fwrite(pkt->data, 1, pkt->size, file);
av_free_packet(pkt);
}
return 0;
error:
return -1;
}
int write_image_to_file(FILE *file, const char *filename, int count, AVFrame *frame, AVCodecContext *codec_context, AVPacket *pkt) {
int res, i;
res = load_image_into_frame(frame, filename);
for (i = 0; i < count; i++) {
res = write_frame_to_file(file, frame, codec_context, pkt);
}
return 0;
error:
return -1;
}
int write_delayed_frames_to_file(FILE *file, AVFrame *frame, AVCodecContext *codec_context, AVPacket *pkt) {
int res, got_output;
for (got_output = 1; got_output;) {
res = avcodec_encode_video2(codec_context, pkt, NULL, &got_output);
if (got_output) {
fwrite(pkt->data, 1, pkt->size, file);
av_free_packet(pkt);
}
}
return 0;
error:
return -1;
}
AVCodecContext *get_codec_context(int width, int height, int fps)
{
int res;
avcodec_register_all();
AVCodec *codec;
AVCodecContext *codec_context = NULL;
codec = avcodec_find_encoder(AV_CODEC_ID_H264);
codec_context = avcodec_alloc_context3(codec);
codec_context->bit_rate = 441000;
codec_context->width = width;
codec_context->height = height;
AVRational temp_113 = {1, fps};
AVRational temp_114 = {fps, 1};
codec_context->time_base= temp_113;
codec_context->gop_size = 10;
codec_context->max_b_frames=1;
codec_context->pix_fmt = AV_PIX_FMT_YUV420P;
res = avcodec_open2(codec_context, codec, NULL);
return codec_context;
error:
return NULL;
}
AVFrame *get_av_frame(AVCodecContext *codec_context) {
int res;
AVFrame *frame;
frame = av_frame_alloc();
frame->height = codec_context->height;
frame->width = codec_context->width;
frame->format = codec_context->pix_fmt;
frame->pts = 0;
res = av_image_alloc(frame->data, frame->linesize, frame->width, frame->height, (AVPixelFormat)frame->format, 1);
return frame;
error:
return NULL;
}
int main(int argc, char **argv)
{
const char *filename = "result video\\test.mp4";
FILE *file=NULL;
int res, retval=-1;
AVCodecContext *codec_context= NULL;
AVFrame *frame=NULL;
AVPacket pkt;
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
codec_context = get_codec_context(1920, 1080, 30);
file = fopen(filename, "wb");
//check(file != NULL, "could not open destination file %s", filename);
frame = get_av_frame(codec_context);
//fwrite(sps, 1, sizeof(sps), file);
//fwrite(pps, 1, sizeof(pps), file);
/*codec_context->extradata = (uint8_t *)malloc(sizeof(uint8_t) * sizeof(spspps));
for(unsigned int index = 0; index < sizeof(spspps); index++)
{
codec_context->extradata[index] = spspps[index];
}
codec_context->extradata_size = (int)sizeof(spspps);*/
codec_context->flags |= CODEC_FLAG_GLOBAL_HEADER;
int i, frames= 51;
for (i = 0; i < frames; i++) {
std::stringstream ss;
ss<<"\\frames\\out"<<( i + 1)<<".jpg";
res = write_image_to_file(file, ss.str().c_str(), 3, frame, codec_context, &pkt);
}
res = write_delayed_frames_to_file(file, frame, codec_context, &pkt);
fwrite(endcode, 1, sizeof(endcode), file);
retval = 0;
error:
if (file)
fclose(file);
if (codec_context) {
avcodec_close(codec_context);
av_free(codec_context);
}
if (frame) {
av_freep(&frame->data[0]);
av_free(frame);
}
return retval;
}
} -
FFMPEG - convert video without losing resolution
29 octobre 2015, par SrhI am using ffmpeg to convert mp4 video from youtube. The video is HD 1080. When I convert it to mpeg2video, the video loses its sharpness, regardless of the
-s 1920x1080
parameter. How can I convert the video without losing picture sharpness ? The command I use is :ffmpeg -i BBB.mp4 -vcodec mpeg2video -s1920x1080 -acodec copy -f mpegts BBB.ts
-
FFMpeg SetSar value gets overriden
8 décembre 2015, par user650922I have a video concatenating application where In all videos are converted to the same format .
I am converting 640*360 video to 1080*720 with setsar=1:1 as
ffmpeg -i C :\Users\work\Desktop\Esocializ\B.mp4 -s 1080*720 -ac 2 -vf setsar=1 :
1 -acodec aac -strict experimental B1.mp4.However for some reasons its value get overridden.
Any help would be appreciated .
Below is my console output :
C:\Users\work\Downloads\ffmpeg-20151130-git-7b11eea-win64-static\ffmpeg-20151130
-git-7b11eea-win64-static\bin
>ffmpeg -i C:\Users\work\Desktop\Esocializ\B.mp4 -s 1080*720 -ac 2 -vf setsar=1:
1 -acodec aac -strict experimental B1.mp4
ffmpeg version N-76957-g7b11eea Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
libavutil 55. 9.100 / 55. 9.100
libavcodec 57. 16.101 / 57. 16.101
libavformat 57. 19.100 / 57. 19.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 17.100 / 6. 17.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\work\Desktop\Esocializ\B.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-02-11 06:48:50
Duration: 00:00:35.04, start: 0.000000, bitrate: 676 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yu
v420p, 640x360 [SAR 1:1 DAR 16:9], 577 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (def
ault)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, flt
p, 95 kb/s (default)
Metadata:
creation_time : 2015-02-11 06:48:50
handler_name : IsoMedia File Produced by Google, 5-11-2011
[Parsed_setsar_0 @ 000000f8a4c8bf20] num:den syntax is deprecated, please use nu
m/den or named options instead
[libx264 @ 000000f8a4919400] using SAR=32/27
[libx264 @ 000000f8a4919400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 000000f8a4919400] profile High, level 3.1
[libx264 @ 000000f8a4919400] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b
_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=
25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.
60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'B1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf57.19.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1
080x720 [SAR 32:27 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.16.101 libx264
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, flt
p, 128 kb/s (default)
Metadata:
creation_time : 2015-02-11 06:48:50
handler_name : IsoMedia File Produced by Google, 5-11-2011
encoder : Lavc57.16.101 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 64 fps=0.0 q=29.0 size= 40kB time=00:00:01.92 bitrate= 168.9kbits/
frame= 118 fps=115 q=29.0 size= 297kB time=00:00:03.87 bitrate= 626.4kbits/
frame= 166 fps=109 q=29.0 size= 589kB time=00:00:05.34 bitrate= 904.1kbits/
frame= 212 fps=104 q=29.0 size= 892kB time=00:00:06.80 bitrate=1074.1kbits/
frame= 250 fps= 98 q=29.0 size= 1201kB time=00:00:08.26 bitrate=1190.0kbits/
frame= 293 fps= 96 q=29.0 size= 1565kB time=00:00:09.72 bitrate=1318.0kbits/
frame= 335 fps= 94 q=29.0 size= 1897kB time=00:00:11.19 bitrate=1388.7kbits/
frame= 374 fps= 92 q=29.0 size= 2227kB time=00:00:12.56 bitrate=1452.5kbits/
frame= 418 fps= 91 q=29.0 size= 2623kB time=00:00:13.93 bitrate=1542.3kbits/
frame= 462 fps= 91 q=29.0 size= 2994kB time=00:00:15.11 bitrate=1622.5kbits/
frame= 499 fps= 89 q=29.0 size= 3306kB time=00:00:16.55 bitrate=1635.7kbits/
frame= 539 fps= 88 q=29.0 size= 3591kB time=00:00:18.01 bitrate=1632.5kbits/
frame= 579 fps= 88 q=29.0 size= 3886kB time=00:00:19.27 bitrate=1651.9kbits/
frame= 623 fps= 88 q=29.0 size= 4184kB time=00:00:20.48 bitrate=1673.4kbits/
frame= 660 fps= 87 q=29.0 size= 4497kB time=00:00:21.91 bitrate=1680.8kbits/
frame= 696 fps= 86 q=29.0 size= 4801kB time=00:00:23.28 bitrate=1688.8kbits/
frame= 742 fps= 86 q=29.0 size= 5119kB time=00:00:24.84 bitrate=1687.9kbits/
frame= 788 fps= 86 q=29.0 size= 5439kB time=00:00:26.30 bitrate=1693.7kbits/
frame= 831 fps= 86 q=29.0 size= 5736kB time=00:00:27.77 bitrate=1692.2kbits/
frame= 878 fps= 86 q=29.0 size= 6041kB time=00:00:29.23 bitrate=1692.7kbits/
frame= 930 fps= 87 q=29.0 size= 6325kB time=00:00:31.18 bitrate=1661.6kbits/
frame= 989 fps= 88 q=29.0 size= 6551kB time=00:00:32.99 bitrate=1626.4kbits/
frame= 1043 fps= 89 q=29.0 size= 6786kB time=00:00:34.64 bitrate=1604.5kbits/
frame= 1051 fps= 86 q=-1.0 Lsize= 7172kB time=00:00:35.03 bitrate=1676.7kbits
/s
video:6600kB audio:541kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 0.433214%
[libx264 @ 000000f8a4919400] frame I:7 Avg QP:21.73 size: 19053
[libx264 @ 000000f8a4919400] frame P:1006 Avg QP:26.11 size: 6523
[libx264 @ 000000f8a4919400] frame B:38 Avg QP:27.27 size: 1616
[libx264 @ 000000f8a4919400] consecutive B-frames: 93.7% 4.2% 0.6% 1.5%
[libx264 @ 000000f8a4919400] mb I I16..4: 10.1% 82.1% 7.8%
[libx264 @ 000000f8a4919400] mb P I16..4: 3.3% 5.4% 0.6% P16..4: 22.7% 7.4
% 2.4% 0.0% 0.0% skip:58.2%
[libx264 @ 000000f8a4919400] mb B I16..4: 0.4% 0.4% 0.0% B16..8: 19.6% 2.1
% 0.3% direct: 0.4% skip:76.9% L0:45.9% L1:48.7% BI: 5.4%
[libx264 @ 000000f8a4919400] 8x8 transform intra:59.5% inter:77.2%
[libx264 @ 000000f8a4919400] coded y,uvDC,uvAC intra: 34.4% 45.3% 13.7% inter: 9
.7% 10.1% 0.3%
[libx264 @ 000000f8a4919400] i16 v,h,dc,p: 36% 50% 3% 11%
[libx264 @ 000000f8a4919400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 25% 26% 3% 4%
5% 4% 4% 4%
[libx264 @ 000000f8a4919400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 29% 17% 2% 4%
5% 4% 3% 2%
[libx264 @ 000000f8a4919400] i8c dc,h,v,p: 51% 25% 18% 6%
[libx264 @ 000000f8a4919400] Weighted P-Frames: Y:0.5% UV:0.4%
[libx264 @ 000000f8a4919400] ref P L0: 81.7% 10.7% 5.9% 1.7% 0.0%
[libx264 @ 000000f8a4919400] ref B L0: 92.3% 7.2% 0.5%
[libx264 @ 000000f8a4919400] ref B L1: 98.9% 1.1%
[libx264 @ 000000f8a4919400] kb/s:1543.06
[aac @ 000000f8a491dec0] Qavg: 686.824
C:\Users\work\Downloads\ffmpeg-20151130-git-7b11eea-win64-static\ffmpeg-20151130
-git-7b11eea-win64-static\bin
>ffmpeg -i B1.mp4
ffmpeg version N-76957-g7b11eea Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
libavutil 55. 9.100 / 55. 9.100
libavcodec 57. 16.101 / 57. 16.101
libavformat 57. 19.100 / 57. 19.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 17.100 / 6. 17.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'B1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.19.100
Duration: 00:00:35.06, start: 0.023220, bitrate: 1675 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x720
[SAR 32:27 DAR 16:9], 1543 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, flt
p, 126 kb/s (default)
Metadata:
handler_name : SoundHandler
At least one output file must be specified
C:\Users\work\Downloads\ffmpeg-20151130-git-7b11eea-win64-static\ffmpeg-20151130
-git-7b11eea-win64-static\bin
>