
Recherche avancée
Médias (91)
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (47)
-
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 -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (9067)
-
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
-
FFMPEG Windows Batch - Recursive Convert based and settings based on Frame Height
3 avril 2017, par Vahid JamaliSo I’m trying to make a batch file to use FFMPEG to convert around 1000 MP4 video files.
I want to recursively go through these folders, possibly use ffprobe to discover the frame height, and then based on the frame height options (360, 480, 720, or 1080 frame height) give them individually different ffmpeg commands.
I’ve been reading up on various approaches to this just as far as batch processing goes.
So far I’m at this stage :
for %%a in ("*.*") do C:\ffinstall\local64\bin-video\ffmpeg -i "%%a" -c:v libx264 -crf 18 -preset veryslow -tune film -refs 8 -bf 6 -aq-mode 2 -filter_complex "[0:v][1:v]overlay=30:main_h-overlay_h-30,subtitles='D:\add.ass'" -c:a copy "encoded\%%~na.mp4"
pause
Code to discover the frame height :
ffprobe -v error -show_entries stream=height -of default=noprint_wrappers=1 inputfile.mp4
Trying to figure out conditionals and how their syntax is. Also I’m getting a Unable to parse option value "add.ass" as image size error. Which I believe is due to not being to see the subtitle file.
Any suggestions on where I can start ? Thanks for any help.