
Advanced search
Medias (1)
-
Bug de détection d’ogg
22 March 2013, by
Updated: April 2013
Language: français
Type: Video
Other articles (60)
-
Les vidéos
21 April 2011, byComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 September 2013, byCertains 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;
-
Use, discuss, criticize
13 April 2011, byTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users.
On other websites (6027)
-
Rotate video adding black bars with ffmpeg
13 February 2016, by MrMoogI have a lot of mp4 full hd videos made with a smartphone that looks rotated 90°.
These files have proper rotation metadata and they plays correctly on VLC or other desktop mediaplayers, but I want to display them on my dvd player that does not handles mp4 metadata.
So I tried to transpose with ffmpeg but I obtain 1080x1920 files, resolution obviously not recognized by tv/dvd-player.
How can I transpose, resize and add black side (left/right) bars of the correct dimensions to get "correct" 1920x1080 videos?
-
ffmpeg frame number or timecode overlay error; need to reset frame count
14 July 2015, by Samuel MehrI’ve got timecode or frame number overlays as per other posts here, but I’m converting videos from AVCHD 59.94fps to H.264 30fps, and the timecode/frameN overlay is keeping the original values. So as I play the new video, the frames are labeled 1,3,5,7, ... but the video plays at normal speed. Is there an option to reset the frame count to the output video’s framerate?
thanks!
ffmpeg -i in.mov -c:v libx264 -r 30 -s 1280x720 -b:v 5400 -vf "drawtext=fontsize=24:fontfile=FONTHERE.otf: timecode='00\:00\:00\:00': r=30: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000099" testtest.mp4
-
FFmpeg encoding live audio to aac issue
12 July 2015, by Ruurd AdemaI’m trying to encode live raw audio coming from a Blackmagic Decklink input card to a mov file with AAC encoding.
The issue is that the audio sounds distorted and plays to fast.
I created the software based on a couple of examples/tutorials including the Dranger tutorial and examples on Github (and of course the examples in the FFmpeg codebase).
Honestly, at this moment I don’t exactly know what the cause of the problem is. I’m thinking about PTS/DTS values or a timebase mismatch (because of the too fast playout), I tried a lot of things, including working with an av_audio_fifo.
- When outputting to the mov file with the AV_CODEC_ID_PCM_S16LE codec, everything works well
- When outputting to the mov file with the AV_CODEC_ID_AAC codec, the problems occur
- When writing RAW audio VLC media info shows:
Type: Audio, Codec: PCM S16 LE (sowt), Language: English, Channels: Stereo, Sample rate: 48000 Hz, Bits per sample. - When writing with AAC codec VLC media info shows:
Type: Audio, Codec: MPEG AAC Audio (mp4a), Language: English, Channels: Stereo, Sample rate: 48000 Hz.
Any idea(s) of what’s causing the problems?
Code
// Create output context
output_filename = "/root/movies/encoder_debug.mov";
output_format_name = "mov";
if (avformat_alloc_output_context2(&output_fmt_ctx, NULL, output_format_name, output_filename) < 0)
{
printf("[ERROR] Unable to allocate output format context for output: %s\n", output_filename);
}
// Create audio output stream
static AVStream *encoder_add_audio_stream(AVFormatContext *oc, enum AVCodecID codec_id)
{
AVCodecContext *c;
AVCodec *codec;
AVStream *st;
st = avformat_new_stream(oc, NULL);
if (!st)
{
printf("[ERROR] Could not allocate new audio stream!\n");
exit(-1);
}
c = st->codec;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_AUDIO;
c->sample_fmt = AV_SAMPLE_FMT_S16;
c->sample_rate = decklink_config()->audio_samplerate;
c->channels = decklink_config()->audio_channel_count;
c->channel_layout = av_get_default_channel_layout(decklink_config()->audio_channel_count);
c->time_base.den = decklink_config()->audio_samplerate;
c->time_base.num = 1;
if (codec_id == AV_CODEC_ID_AAC)
{
c->bit_rate = 96000;
//c->profile = FF_PROFILE_AAC_MAIN; //FIXME Generates error: "Unable to set the AOT 1: Invalid config"
// Allow the use of the experimental AAC encoder
c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
}
// Some formats want stream headers to be seperate (global?)
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
{
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
codec = avcodec_find_encoder(c->codec_id);
if (!codec)
{
printf("[ERROR] Audio codec not found\n");
exit(-1);
}
if (avcodec_open2(c, codec, NULL) < 0)
{
printf("[ERROR] Could not open audio codec\n");
exit(-1);
}
return st;
}
// En then, at every incoming frame this function gets called:
void encoder_handle_incoming_frame(IDeckLinkVideoInputFrame *videoframe, IDeckLinkAudioInputPacket *audiopacket)
{
void *pixels = NULL;
int pitch = 0;
int got_packet = 0;
void *audiopacket_data = NULL;
long audiopacket_sample_count = 0;
long audiopacket_size = 0;
long audiopacket_channel_count = 2;
if (audiopacket)
{
AVPacket pkt = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
AVFrame *frame;
BMDTimeValue audio_pts;
int requested_size;
static int last_pts1, last_pts2 = 0;
audiopacket_sample_count = audiopacket->GetSampleFrameCount();
audiopacket_channel_count = decklink_config()->audio_channel_count;
audiopacket_size = audiopacket_sample_count * (decklink_config()->audio_sampletype/8) * audiopacket_channel_count;
audiopacket->GetBytes(&audiopacket_data);
av_init_packet(&pkt);
printf("\n=== Audiopacket: %d ===\n", audio_stream->codec->frame_number);
if (AUDIO_TYPE == AV_CODEC_ID_PCM_S16LE)
{
audiopacket->GetPacketTime(&audio_pts, audio_stream->time_base.den);
pkt.pts = audio_pts;
pkt.dts = pkt.pts;
pkt.flags |= AV_PKT_FLAG_KEY; // TODO: Make sure if this still applies
pkt.stream_index = audio_stream->index;
pkt.data = (uint8_t *)audiopacket_data;
pkt.size = audiopacket_size;
printf("[PACKET] size: %d\n", pkt.size);
printf("[PACKET] pts: %li\n", pkt.pts);
printf("[PACKET] pts delta: %li\n", pkt.pts - last_pts2);
printf("[PACKET] duration: %d\n", pkt.duration);
last_pts2 = pkt.pts;
av_interleaved_write_frame(output_fmt_ctx, &pkt);
}
else if (AUDIO_TYPE == AV_CODEC_ID_AAC)
{
frame = av_frame_alloc();
frame->format = audio_stream->codec->sample_fmt;
frame->channel_layout = audio_stream->codec->channel_layout;
frame->sample_rate = audio_stream->codec->sample_rate;
frame->nb_samples = audiopacket_sample_count;
requested_size = av_samples_get_buffer_size(NULL, audio_stream->codec->channels, audio_stream->codec->frame_size, audio_stream->codec->sample_fmt, 1);
audiopacket->GetPacketTime(&audio_pts, audio_stream->time_base.den);
printf("[DEBUG] Sample format: %d\n", frame->format);
printf("[DEBUG] Channel layout: %li\n", frame->channel_layout);
printf("[DEBUG] Sample rate: %d\n", frame->sample_rate);
printf("[DEBUG] NB Samples: %d\n", frame->nb_samples);
printf("[DEBUG] Datasize: %li\n", audiopacket_size);
printf("[DEBUG] Requested datasize: %d\n", requested_size);
printf("[DEBUG] Too less/much: %li\n", audiopacket_size - requested_size);
printf("[DEBUG] Framesize: %d\n", audio_stream->codec->frame_size);
printf("[DEBUG] Audio pts: %li\n", audio_pts);
printf("[DEBUG] Audio pts delta: %li\n", audio_pts - last_pts1);
last_pts1 = audio_pts;
frame->pts = audio_pts;
if (avcodec_fill_audio_frame(frame, audiopacket_channel_count, audio_stream->codec->sample_fmt, (const uint8_t *)audiopacket_data, audiopacket_size, 0) < 0)
{
printf("[ERROR] Filling audioframe failed!\n");
exit(-1);
}
got_packet = 0;
if (avcodec_encode_audio2(audio_stream->codec, &pkt, frame, &got_packet) != 0)
{
printf("[ERROR] Encoding audio failed\n");
}
if (got_packet)
{
pkt.stream_index = audio_stream->index;
pkt.flags |= AV_PKT_FLAG_KEY;
//printf("[PACKET] size: %d\n", pkt.size);
//printf("[PACKET] pts: %li\n", pkt.pts);
//printf("[PACKET] pts delta: %li\n", pkt.pts - last_pts2);
//printf("[PACKET] duration: %d\n", pkt.duration);
//printf("[PACKET] timebase codec: %d/%d\n", audio_stream->codec->time_base.num, audio_stream->codec->time_base.den);
//printf("[PACKET] timebase stream: %d/%d\n", audio_stream->time_base.num, audio_stream->time_base.den);
last_pts2 = pkt.pts;
av_interleaved_write_frame(output_fmt_ctx, &pkt);
}
av_frame_free(&frame);
}
av_free_packet(&pkt);
}
else
{
printf("[WARNING] No audiopacket received!\n");
}
static int count = 0;
count++;
}