
Recherche avancée
Médias (29)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (41)
-
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 (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)
Sur d’autres sites (6542)
-
How to reconnect using avformat_open_input without having to alloc the decoder again ?
26 septembre 2012, par JonaCurrently, I have a code based on ffplay to stream live content.
One thing I'm looking to do is be able to reconnect upon loosing a connection without having to shutdown the whole decoding process.
To me the solution is alloc the decoder myself once and keep using it across reconnections. I can't seem to figure out how to setup a decoder without having to depend on the
AVFormatContext
. Right now my code is failing when trying to use my own allocatedAVCodecContext
to decode. But it doesn't fail if I use theAVCodecContext
given byAVFormatContext
.This is part of my initial code :
// attempt to find more information about the codec
// also it will open the codecs needed.
fferror = avformat_find_stream_info(ic, NULL);
if (0 > fferror)
{
// TODO verify type of error to better map it to our errors
error = ERROR_FAIL_TO_CONNECT;
LOGE("download() -> avformat_find_stream_info failed! fferror:%d, error:%d", fferror, error);
goto fail;
}
AVCodec *dec;
// select the audio stream
int ret = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0);
if (0 > ret) {
error = ERROR_UNEXPECTED_ERROR;
LOGE("download() -> av_find_best_stream failed! ret:%d, error:%d", ret, error);
goto fail;
}
LOGI("download() -> STREAM: nb_streams:%d", ic->nb_streams);
LOGI("download() -> STREAM: audio format:%s", ic->iformat->name);
LOGI("download() -> STREAM: audio bitrate:%d", ic->bit_rate);
// save the audio stream index and source
is->audio_stream_index = ret;
is->audio_st = ic->streams[is->audio_stream_index];
is->audio_buf_size = 0;
is->audio_buf_index = 0;
is->audio_st->discard = AVDISCARD_DEFAULT;
if(ic->pb) {
ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
}
if (show_status) {
av_dump_format(ic, 0, is->filename, 0);
}
// open codec
error = open_decoder(is->audio_st->codec, dec);
if (ERROR_NO_ERROR != error) {
LOGE("receive_thread() -> open_decoder failed! error:%d", error);
goto fail;
}And this is the funtion that initializes the decoder.
static int open_decoder (AVCodecContext *avctx, AVCodec *codec)
{
int fferror = 0;
AVCodecContext *c = NULL;
if (smDecoder.open) {
LOGW("open_decoder() -> decoder is already open!");
return ERROR_NO_ERROR;
}
// find the decoder
if (!codec)
{
codec = avcodec_find_decoder(avctx->codec_id);
if (!codec)
{
LOGE("open_decoder() -> avcodec_find_decoder failed!");
return ERROR_UNEXPECTED_ERROR;
}
}
// allocate the decoder av context
c = avcodec_alloc_context3(codec);
if (NULL == c) {
LOGE("open_decoder() -> avcodec_alloc_context3 failed! Out of memory?");
return ERROR_UNEXPECTED_ERROR;
}
// check if the type of codec we support
if (AVMEDIA_TYPE_AUDIO != c->codec_type)
{
LOGE("open_decoder() -> codec_type not supported! codec_type:%d",c->codec_type);
return ERROR_UNEXPECTED_ERROR;
}
// set the proper channels if not properly set
if (c->channels > 0) {
c->request_channels = FFMIN(2, c->channels);
} else {
c->request_channels = 2;
}
c->debug_mv = 0;
c->debug = 0;
c->workaround_bugs = workaround_bugs;
c->idct_algo= idct;
if(fast) c->flags2 |= CODEC_FLAG2_FAST;
c->error_concealment= error_concealment;
c->thread_count = thread_count;
// open the decoder
fferror = avcodec_open2(avctx, codec, NULL);
if (fferror < 0)
{
LOGE("open_decoder() -> avcodec_open2 failed! fferror:%d", fferror);
return ERROR_UNEXPECTED_ERROR;
}
// clean up our reusable packet
memset(&smDecoder.audio_pkt, 0, sizeof(smDecoder.audio_pkt));
smDecoder.open = 1;
smDecoder.codec = codec;
smDecoder.avctx = c;
return ERROR_NO_ERROR;
} -
Revision a272530bf0 : Two optimizations : 1. Reduced the size memset based on eob for 32x32 transform.
1er novembre 2013, par Yaowu XuChanged Paths :
Modify /vp9/decoder/vp9_decodframe.c
Two optimizations :1. Reduced the size memset based on eob for 32x32 transform. The reset
of non-zero coefficient should probably go into where they are read in
inverse transform functions. (TODO)
2. Removed a redundant level of indirection.
vp9_iht4x4_add() checks transform type and call vp9_iht4x4_16_add()
for tranforms other than DCT_DCT. In this case, the DCT_DCT case
has been already handled here.Change-Id : Iacbc77da761f0b308df5acea0f20c9add9f33d20
-
video overwriting using ffmpeg - I want to Add video rotation code and rewrite the existing file..How can i do that ?
27 octobre 2013, par Lakshmi Priya.KI want to rotate the .mov file which is in portrait mode by 90 degrees, for that i used the following code..
It works but, it results in loss of video frames...My code is,
public void encode(File source, File target, EncodingAttributes attributes,
EncoderProgressListener listener, Integer i) throws IllegalArgumentException,
InputFormatException, EncoderException {
String formatAttribute = attributes.getFormat();
Float offsetAttribute = attributes.getOffset();
Float durationAttribute = attributes.getDuration();
QualityScale qualityScale = attributes.getQualityScale();
AudioAttributes audioAttributes = attributes.getAudioAttributes();
VideoAttributes videoAttributes = attributes.getVideoAttributes();
if (audioAttributes == null && videoAttributes == null) {
throw new IllegalArgumentException(
"Both audio and video attributes are null");
}
target = target.getAbsoluteFile();
target.getParentFile().mkdirs();
FFMPEGExecutor ffmpeg = locator.createExecutor();
if (offsetAttribute != null) {
ffmpeg.addArgument("-ss");
ffmpeg.addArgument(String.valueOf(offsetAttribute.floatValue()));
}
ffmpeg.addArgument("-i");
ffmpeg.addArgument(source.getAbsolutePath());
if (durationAttribute != null) {
ffmpeg.addArgument("-t");
ffmpeg.addArgument(String.valueOf(durationAttribute.floatValue()));
}
if (qualityScale != null) {
ffmpeg.addArgument("-qscale:"+qualityScale.getQualityStreamSpecifier());
ffmpeg.addArgument(String.valueOf(qualityScale.getQualityValue()));
}
if (videoAttributes == null) {
ffmpeg.addArgument("-vn");
} else {
String codec = videoAttributes.getCodec();
if (codec != null) {
ffmpeg.addArgument("-vcodec");
ffmpeg.addArgument(codec);
}
String tag = videoAttributes.getTag();
if (tag != null) {
ffmpeg.addArgument("-vtag");
ffmpeg.addArgument(tag);
}
Integer bitRate = videoAttributes.getBitRate();
if (bitRate != null) {
ffmpeg.addArgument("-b");
ffmpeg.addArgument(String.valueOf(bitRate.intValue()));
}
Integer frameRate = videoAttributes.getFrameRate();
if (frameRate != null) {
ffmpeg.addArgument("-r");
ffmpeg.addArgument(String.valueOf(frameRate.intValue()));
}
VideoSize size = videoAttributes.getSize();
if (size != null) {
ffmpeg.addArgument("-s");
ffmpeg.addArgument(String.valueOf(size.getWidth()) + "x"
+ String.valueOf(size.getHeight()));
}
FilterGraph filterGraph = videoAttributes.getFilterGraph();
if (filterGraph != null) {
ffmpeg.addArgument("-vf");
if(videoAttributes.getRotate() != null && videoAttributes.getRotate() == 90){
ffmpeg.addArgument("transpose=1");
}else if(videoAttributes.getRotate() != null && videoAttributes.getRotate() == 180){
ffmpeg.addArgument("vflip,hflip");
}
else {
if (filterGraph.isUseExpression()) {
ffmpeg.addArgument(filterGraph.getFilterGraphExpression());
}
}
}
}
if (audioAttributes == null) {
ffmpeg.addArgument("-an");
} else {
String codec = audioAttributes.getCodec();
if (codec != null) {
ffmpeg.addArgument("-acodec");
ffmpeg.addArgument(codec);
}
Integer bitRate = audioAttributes.getBitRate();
if (bitRate != null) {
ffmpeg.addArgument("-ab");
ffmpeg.addArgument(String.valueOf(bitRate.intValue()));
}
Integer channels = audioAttributes.getChannels();
if (channels != null) {
ffmpeg.addArgument("-ac");
ffmpeg.addArgument(String.valueOf(channels.intValue()));
}
Integer samplingRate = audioAttributes.getSamplingRate();
if (samplingRate != null) {
ffmpeg.addArgument("-ar");
ffmpeg.addArgument(String.valueOf(samplingRate.intValue()));
}
Integer volume = audioAttributes.getVolume();
if (volume != null) {
ffmpeg.addArgument("-vol");
ffmpeg.addArgument(String.valueOf(volume.intValue()));
}
}
ffmpeg.addArgument("-f");
ffmpeg.addArgument(formatAttribute);
ffmpeg.addArgument("-y");
ffmpeg.addArgument(target.getAbsolutePath());
try {
ffmpeg.execute();
} catch (IOException e) {
throw new EncoderException(e);
}
try {
String lastWarning = null;
long duration;
long progress = 0;
RBufferedReader reader = null;
reader = new RBufferedReader(new InputStreamReader(ffmpeg
.getErrorStream()));
MultimediaInfo info = parseMultimediaInfo(source, reader);
if (durationAttribute != null) {
duration = (long) Math
.round((durationAttribute.floatValue() * 1000L));
} else {
duration = info.getDuration();
if (offsetAttribute != null) {
duration -= (long) Math
.round((offsetAttribute.floatValue() * 1000L));
}
}
if (listener != null) {
listener.sourceInfo(info);
}
int step = 0;
String line;
while ((line = reader.readLine()) != null) {
System.out.println("line::::"+line);
if (step == 0) {
if (line.startsWith("WARNING: ")) {
if (listener != null) {
listener.message(line);
}
} else if (!line.startsWith("Output #0")) {
//throw new EncoderException(line);
} else {
step++;
}
} else if (step == 1) {
if (!line.startsWith(" ")) {
step++;
} else {
System.out.println("line>>>>>>"+line);
Hashtable table1 = new Hashtable();
Matcher m = ROTATE_INFO_PATTERN.matcher(line);
while (m.find()) {
if (table1 == null) {
table1 = new Hashtable();
}
String key = m.group(1);
String value = m.group(2);
table1.put(key, value);
}
System.out.println("Table values"+table1.get("rotate"));
if(table1.get("rotate") != null){
Object videoRotateValue = table1.get("rotate");
int rotate = Integer.valueOf(videoRotateValue.toString());
switch(rotate){
case 90:
videoAttributes.setRotate(rotate);
if(i == 0){
i++;
encode(source, target, attributes, null, i);
}
break;
case 180:
videoAttributes.setRotate(rotate);
if(i == 0){
i++;
encode(source, target, attributes, null, i);
}
break;
case 270: System.out.println("case 3 :: "+videoRotateValue);
break;
}
}
}
}
if (step == 2) {
if (!line.startsWith("Stream mapping:")) {
throw new EncoderException(line);
} else {
step++;
}
} else if (step == 3) {
if (!line.startsWith(" ")) {
step++;
}
}
if (step == 4) {
line = line.trim();
if (line.length() > 0) {
Hashtable table = parseProgressInfoLine(line);
if (table == null) {
if (listener != null) {
listener.message(line);
}
lastWarning = line;
} else {
if (listener != null) {
String time = (String) table.get("time");
if (time != null) {
int dot = time.indexOf('.');
if (dot > 0 && dot == time.length() - 2
&& duration > 0) {
String p1 = time.substring(0, dot);
String p2 = time.substring(dot + 1);
try {
long i1 = Long.parseLong(p1);
long i2 = Long.parseLong(p2);
progress = (i1 * 1000L)
+ (i2 * 100L);
int perm = (int) Math
.round((double) (progress * 1000L)
/ (double) duration);
if (perm > 1000) {
perm = 1000;
}
listener.progress(perm);
} catch (NumberFormatException e) {
;
}
}
}
}
lastWarning = null;
}
}
}
}
if (lastWarning != null) {
if (!SUCCESS_PATTERN.matcher(lastWarning).matches()) {
throw new EncoderException(lastWarning);
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
ffmpeg.destroy();
}
}Please advise, how to achieve video rotation without any video Frame loss
Thanks In Advance
Lakshmi Priya . K