
Recherche avancée
Autres articles (55)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (5413)
-
Solved : ffmpeg : How can a MOV with transparent background be created ?
25 mars 2017, par Mat(Remark : the error sat, as usual, between back-rest and keyboard. Thanks, Mulvya !)
Hi, specialists !
I’m trying - with no success at all - to convert the green pixels of a background into transparent ones and output the result as clip with ffmpeg. N.b. I do not want to lay the clip over anything ; I’m not having a problem with that. What I want is a clip with transparent background for the OpenShot video editor (the chromakey filter of which doesn’t work satisfyingly).
What I have tried (amongst a felt 1 zillion other things over the last 15 hrs.) was
ffmpeg.exe -i in.mov -vf chromakey=0x008001:0.115:0.0 -c:v qtrle out.mov
but the pixels simply would not be transparent. Seemingly, nothing happens. I reckon the filter is ok, because it works fine in a complex chain (overlaying a background image).
The output of ffprompt -show_stream -show_format of out.mov is as follows :
[STREAM]
index=0
codec_name=qtrle
codec_long_name=QuickTime Animation (RLE) video
profile=unknown
codec_type=video
codec_time_base=1/30
codec_tag_string=rle
codec_tag=0x20656c72
width=1920
height=1080
coded_width=1920
coded_height=1080
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=bgra
level=-99
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=progressive
timecode=N/A
refs=1
id=N/A
r_frame_rate=30/1
avg_frame_rate=30/1
time_base=1/15360
start_pts=0
start_time=0.000000
duration_ts=54789
duration=3.566992
bit_rate=822383192
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=107
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
TAG:encoder=Lavc57.64.101 qtrle
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=926
start_time=0.020998
duration_ts=157481
duration=3.570998
bit_rate=132103
max_bit_rate=132103
bits_per_raw_sample=N/A
nb_frames=153
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
[/STREAM]
[FORMAT]
filename=out.mov
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=3.567000
size=366708874
bit_rate=822447712
probe_score=100
TAG:major_brand=qt
TAG:minor_version=512
TAG:compatible_brands=qt
TAG:encoder=Lavf57.56.101
[/FORMAT]I have a "sample" clip which shows the behaviour I want, with the following stream and information :
[STREAM]
index=0
codec_name=qtrle
codec_long_name=QuickTime Animation (RLE) video
profile=unknown
codec_type=video
codec_time_base=1/24
codec_tag_string=rle
codec_tag=0x20656c72
width=1920
height=1080
coded_width=1920
coded_height=1080
has_b_frames=0
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=bgra
level=-99
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=progressive
timecode=N/A
refs=1
id=N/A
r_frame_rate=24/1
avg_frame_rate=24/1
time_base=1/12288
start_pts=0
start_time=0.000000
duration_ts=74760
duration=6.083984
bit_rate=49226848
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=146
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
TAG:encoder=Lavc57.24.102 qtrle
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=293856
duration=6.122000
bit_rate=53537
max_bit_rate=128000
bits_per_raw_sample=N/A
nb_frames=288
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
[/STREAM]
[FORMAT]
filename=templateOK.mov
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=6.144000
size=37478506
bit_rate=48800138
probe_score=100
TAG:major_brand=qt
TAG:minor_version=512
TAG:compatible_brands=qt
TAG:encoder=Lavf57.25.100
[/FORMAT]and I simply am not able to spot the relevant difference.
Any suggestions would be highly appreciated !
Cheers,
Mat
The input, output and the working template can be found here.
(The security issue you might see when clicking the link comes from the server certificate being self-signed. You can accept a temporal exception. Btw : The ridiculous file size of the output file will be the next nut to crack. Probably s.t. about compression.)
-
ffmpeg : How can a MOV with transparent background be created ?
25 mars 2017, par MatI’m trying - with no success at all - to convert the green pixels of a background into transparent ones and output the result as clip with ffmpeg. N.b. I do not want to lay the clip over anything ; I’m not having a problem with that. What I want is a clip with transparent background for the OpenShot video editor (the chromakey filter of which doesn’t work satisfyingly).
What I have tried (amongst 1 zillion other things over the last 15 hrs.) was
ffmpeg.exe -i in.mov -vf chromakey=0x008001:0.115:0.0 -c:v qtrle out.mov
but the pixels simply would not be transparent. Seemingly, nothing happens. I reckon the filter is ok, because it works fine in a complex chain (overlaying a background image).
The output of ffprompt -show_stream -show_format of out.mov is as follows :
[STREAM]
index=0
codec_name=qtrle
codec_long_name=QuickTime Animation (RLE) video
profile=unknown
codec_type=video
codec_time_base=1/30
codec_tag_string=rle
codec_tag=0x20656c72
width=1920
height=1080
coded_width=1920
coded_height=1080
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=bgra
level=-99
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=progressive
timecode=N/A
refs=1
id=N/A
r_frame_rate=30/1
avg_frame_rate=30/1
time_base=1/15360
start_pts=0
start_time=0.000000
duration_ts=54789
duration=3.566992
bit_rate=822383192
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=107
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
TAG:encoder=Lavc57.64.101 qtrle
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=926
start_time=0.020998
duration_ts=157481
duration=3.570998
bit_rate=132103
max_bit_rate=132103
bits_per_raw_sample=N/A
nb_frames=153
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
[/STREAM]
[FORMAT]
filename=out.mov
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=3.567000
size=366708874
bit_rate=822447712
probe_score=100
TAG:major_brand=qt
TAG:minor_version=512
TAG:compatible_brands=qt
TAG:encoder=Lavf57.56.101
[/FORMAT]I have a "sample" clip which shows the behaviour I want, with the following stream and information :
[STREAM]
index=0
codec_name=qtrle
codec_long_name=QuickTime Animation (RLE) video
profile=unknown
codec_type=video
codec_time_base=1/24
codec_tag_string=rle
codec_tag=0x20656c72
width=1920
height=1080
coded_width=1920
coded_height=1080
has_b_frames=0
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=bgra
level=-99
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=progressive
timecode=N/A
refs=1
id=N/A
r_frame_rate=24/1
avg_frame_rate=24/1
time_base=1/12288
start_pts=0
start_time=0.000000
duration_ts=74760
duration=6.083984
bit_rate=49226848
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=146
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
TAG:encoder=Lavc57.24.102 qtrle
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=293856
duration=6.122000
bit_rate=53537
max_bit_rate=128000
bits_per_raw_sample=N/A
nb_frames=288
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=DataHandler
[/STREAM]
[FORMAT]
filename=templateOK.mov
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=6.144000
size=37478506
bit_rate=48800138
probe_score=100
TAG:major_brand=qt
TAG:minor_version=512
TAG:compatible_brands=qt
TAG:encoder=Lavf57.25.100
[/FORMAT]and I simply am not able to spot the relevant difference.
The input, output and the working template can be found here.
(The security issue you might see when clicking the link comes from the server certificate being self-signed. You can accept a temporal exception. Btw : The ridiculous file size of the output file will be the next nut to crack. Probably something about compression.)
-
ffmpeg API muxing h264 endoced frames to mkv
24 mars 2017, par Pawel KHi I’m having some problems with muxing h264 encoded frames into mkv container using code of ffmpeg-3.2.4.
I have ended up with the following code that is a mashup of code found on SO and muxing.c example of ffmpeg :
(and yes I am aware that it is ugly, no errors checked etc. it is meant to be like that for clarity :) )char *filename = "out.mkv";
const uint8_t SPS[] = { 0x67, 0x42, 0x40, 0x1F, 0x96, 0x54, 0x02, 0x80, 0x2D, 0xD0, 0x0F, 0x39, 0xEA };
const uint8_t PPS[] = { 0x68, 0xCE, 0x38, 0x80 };
int fps = 5;
typedef struct OutputStream
{
AVStream *st;
AVCodecContext *enc;
/* pts of the next frame that will be generated */
int64_t next_pts;
int samples_count;
AVFrame *frame;
AVFrame *tmp_frame;
float t, tincr, tincr2;
struct SwsContext *sws_ctx;
struct SwrContext *swr_ctx;
} OutputStream;
static void avlog_cb(void *s, int level, const char *szFmt, va_list varg)
{
vprintf(szFmt, varg);
}
void main()
{
AVOutputFormat *fmt;
AVFormatContext *formatCtx;
AVCodec *audio_codec;
AVCodec *video_codec;
OutputStream video_st = { 0 };
OutputStream audio_st = { 0 };
av_register_all();
av_log_set_level(AV_LOG_TRACE);
//av_log_set_callback(avlog_cb);
//allocate output and format ctxs
avformat_alloc_output_context2(&formatCtx, NULL, NULL, filename);
fmt = formatCtx->oformat;
//allocate streams
video_codec = avcodec_find_encoder(fmt->video_codec);
video_st.st = avformat_new_stream(formatCtx, NULL);
video_st.st->id = 0;
AVCodecContext *codecCtx = avcodec_alloc_context3(video_codec);
fmt->video_codec = AV_CODEC_ID_H264;
video_st.enc = codecCtx;
codecCtx->codec_id = fmt->video_codec;
codecCtx->bit_rate = 400000;
codecCtx->width = 1080;
codecCtx->height = 720;
codecCtx->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
codecCtx->level = 31;
video_st.st->time_base = (AVRational){ 1, fps };
codecCtx->time_base = video_st.st->time_base;
codecCtx->gop_size = 4;
codecCtx->pix_fmt = AV_PIX_FMT_YUV420P;
//open video codec
codecCtx->extradata_size = 24;
codecCtx->extradata = (uint8_t *)av_malloc(codecCtx->extradata_size);
uint8_t extra_data_array[] = { 0x01, SPS[1], SPS[2], SPS[3], 0xFF, 0xE1, 0xc0, 0, 0x42, 0x40, 0x1F, 0x96, 0x54, 0x02, 0x80, 0x2D, 0xD0, 0x0F, 0x39, 0xEA, 0x03, 0xCE, 0x38, 0x80 };
memcpy(codecCtx->extradata, extra_data_array, codecCtx->extradata_size);
AVCodecContext *c = video_st.enc;
AVDictionary *opt = NULL;
avcodec_open2(c, video_codec, &opt);
avcodec_parameters_from_context(video_st.st->codecpar, c);
//open output file
avio_open(&formatCtx->pb, filename, AVIO_FLAG_WRITE);
//write header
int res = avformat_write_header(formatCtx, NULL);
//write frames
// get the frames from file
uint32_t u32frameCnt = 0;
do
{
int8_t i8frame_name[64] = "";
uint8_t *pu8framePtr = NULL;
AVPacket pkt = { 0 };
av_init_packet(&pkt);
sprintf(i8frame_name, "frames/frame%d.bin", u32frameCnt++);
//reading frames from files
FILE *ph264Frame = fopen(i8frame_name, "r");
if(NULL == ph264Frame)
{
goto leave;
}
//get file size
fseek(ph264Frame, 0L, SEEK_END);
uint32_t u32file_size = 0;
u32file_size = ftell(ph264Frame);
fseek(ph264Frame, 0L, SEEK_SET);
pu8framePtr = malloc(u32file_size);
uint32_t u32readout = fread(pu8framePtr, 1, u32file_size, ph264Frame);
//if the read frame is a key frame i.e. nalu hdr type = 5 set it as a key frame
if(0x65 == pu8framePtr[4])
{
pkt.flags = AV_PKT_FLAG_KEY;
}
pkt.data = (uint8_t *)pu8framePtr;
pkt.size = u32readout;
pkt.pts = u32frameCnt;
pkt.dts = pkt.pts;
av_packet_rescale_ts(&pkt, c->time_base, video_st.st->time_base);
pkt.stream_index = video_st.st->index;
av_interleaved_write_frame(formatCtx, &pkt);
free(pu8framePtr);
fclose(ph264Frame);
}
while(1);
leave:
av_write_trailer(formatCtx);
av_dump_format(formatCtx, 0, filename, 1);
avcodec_free_context(&video_st.enc);
avio_closep(&formatCtx->pb);
avformat_free_context(formatCtx);
}It can be compiled with the following command line (after adding headers) :
gcc file.c -o test_app -I/usr/local/include -L/usr/local/lib -lxcb-shm -lxcb -lX11 -lx264 -lm -lz -pthread -lswresample -lswscale -lavcodec -lavformat -lavdevice -lavutil
The files that are read are valid annexB stream (valid as in it’s playable in vlc after concatenating into file) it is a Constrained Baseline 3.1 profile H264 and it comes from an IPcam’s interleaved RTCP/RTP stream (demuxed)
The result is ... well I don’t see the picture. I get only black screen with the progress bar and timer running. I don’t know if I do something wrong with setting up the codecs and streams, or it’s just wrong timestamps.
I know I got them wrong in some manner but I don’t understand that fully yet (how to calculate the correct presentation times), i.e. the stream and the codec both contain time_base field, and then I know that the sample rate of the video is 90kHz and the frame rate is 5 fpsOn top of it all the examples I’ve found have to some extend deprecated parts that change the flow/meaning of the application and that doesn’t help at all so thus If anyone could help I would appreciate it (I think not only me I would guess)
Regards, Pawel