
Recherche avancée
Autres articles (100)
-
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 (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)
Sur d’autres sites (8692)
-
How can I use ffmpeg to crop a part of a video by frames numbers including video and audio ?
28 mars 2019, par Dubi DuboniI have a simple list :
LReg.start = rise[i];
LReg.end = fall[i];
LR.Add(LReg);start and end are int’s in the end I have a List of the frames I want to extract from a video file. For example in index 0 of LR I have start 48 end 51
In index 1 start 110 end 124So I want to loop over the List an save as a video file the part of a video file using ffmpeg according to the frame number start and end by jumping to this frames.
Jump to frame 48 and create a video file out from frame 48 to 51 including 48 and 51. Then jump forward to the next group of frames 110 and 124 and so on.The problem is how to use ffmpeg to extract and save video files ?
-
How can I re-encode video frames to another codec using ffmpeg ?
24 juillet 2019, par Pedro ConstantinoI am trying to learn ffmpeg, so I started a small project where I am sending an MP4 video stream to my C# application where I want to re-encode the video to webM and send it to an icecast server.
My icecast server is receiving the video but I am not able to reproduce it (the video time is updated each time I press play but the video doesn’t play and I only see a black frame)
Anyone can help me ? I have no idea of what is wrong in my code.
My code execution flow is openInput->openOutput->streamingTest
private void openInput()
{
_pInputFormatContext = ffmpeg.avformat_alloc_context();
var pFormatContext = _pInputFormatContext;
ffmpeg.avformat_open_input(&pFormatContext, configuration.Source, null, null).ThrowExceptionIfError();
ffmpeg.avformat_find_stream_info(_pInputFormatContext, null).ThrowExceptionIfError();
// find the first video stream
for (var i = 0; i < _pInputFormatContext->nb_streams; i++)
if (_pInputFormatContext->streams[i]->codec->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO)
{
pInputStream = _pInputFormatContext->streams[i];
break;
}
if (pInputStream == null) throw new InvalidOperationException("Could not found video stream.");
_inputStreamIndex = pInputStream->index;
_pInputCodecContext = pInputStream->codec;
var codecId = _pInputCodecContext->codec_id;
var pCodec = ffmpeg.avcodec_find_decoder(codecId);
if (pCodec == null) throw new InvalidOperationException("Unsupported codec.");
ffmpeg.avcodec_open2(_pInputCodecContext, pCodec, null).ThrowExceptionIfError();
configuration.CodecName = ffmpeg.avcodec_get_name(codecId);
configuration.FrameSize = new Size(_pInputCodecContext->width, _pInputCodecContext->height);
configuration.PixelFormat = _pInputCodecContext->pix_fmt;
_pPacket = ffmpeg.av_packet_alloc();
_pFrame = ffmpeg.av_frame_alloc();
}
private bool openOutput()
{
int ret;
_pOutputFormatContext = ffmpeg.avformat_alloc_context();
fixed (AVFormatContext** ppOutputFormatContext = &_pOutputFormatContext)
{
ret = ffmpeg.avformat_alloc_output_context2(ppOutputFormatContext, null, "webm", configuration.Destination);
if (ret < 0)
{
return false;
}
}
AVOutputFormat* out_format = ffmpeg.av_guess_format(null, configuration.Destination, null);
// Configure output video stream
_pOutputStream = ffmpeg.avformat_new_stream(_pOutputFormatContext, null);
AVStream* pInputVideoStream = null;
for (var i = 0; i < _pInputFormatContext->nb_streams; i++)
{
if (_pInputFormatContext->streams[i]->codec->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO)
{
pInputVideoStream = _pInputFormatContext->streams[i];
}
}
ffmpeg.avcodec_parameters_copy(_pOutputStream->codecpar, pInputVideoStream->codecpar);
_pOutputStream->codecpar->codec_type = AVMediaType.AVMEDIA_TYPE_VIDEO;
_pOutputStream->codecpar->codec_id = AVCodecID.AV_CODEC_ID_VP8;
AVDictionary* opt_dict;
ffmpeg.av_dict_set(&opt_dict, "content_type", "video/webm", 0);
ffmpeg.av_dict_set(&opt_dict, "user_agent", "GCS", 0);
fixed (AVFormatContext** ppOutputFormatContext = &_pOutputFormatContext)
{
ret = ffmpeg.avio_open2(&_pOutputFormatContext->pb, configuration.Destination, ffmpeg.AVIO_FLAG_WRITE, null, &opt_dict);
if (ret < 0)
{
return false;
}
}
ret = ffmpeg.avformat_write_header(_pOutputFormatContext, null);
if (ret < 0)
{
return false;
}
ffmpeg.av_dump_format(_pOutputFormatContext, 0, configuration.Destination, 1);
return true;
}
private unsafe void streamingTest(object gggg)
{
isStreamUp = true;
AVPacket frame = new AVPacket();
AVPacket* pFrame = &frame;
ffmpeg.av_init_packet(pFrame);
updateState(VideoStreamStates.Streaming);
try
{
long start_time = ffmpeg.av_gettime();
DateTime lastFrame = DateTime.MinValue;
while (isStreamUp)
{
if (cancelationToken.IsCancellationRequested)
{
throw new TaskCanceledException();
}
try
{
int error;
isReadingFrame = true;
do
{
error = ffmpeg.av_read_frame(_pInputFormatContext, pFrame);
if (error == ffmpeg.AVERROR_EOF)
{
frame = *pFrame;
continue;
}
error.ThrowExceptionIfError();
} while (frame.stream_index != _inputStreamIndex);
isWritingFrame = true;
//frame.stream_index = _outputStreamIndex;
_pOutputCodecContext = ffmpeg.avcodec_alloc_context3(_pOutputFormatContext->video_codec);
int ret = 0;
while (ret >= 0)
{
ret = ffmpeg.avcodec_receive_packet(_pOutputCodecContext, pFrame);
}
//ffmpeg.avcodec_send_frame(_pOutputCodecContext, pFrame);
//ffmpeg.avcodec_send_packet(_pOutputCodecContext, pFrame);
ret = ffmpeg.av_write_frame(_pOutputFormatContext, pFrame);
isWritingFrame = false;
if (frame.stream_index == _inputStreamIndex)
{
if (ret < 0)
{
Console.WriteLine("Missed frame");
missedFrames++;
}
else
{
Console.WriteLine("Sent frame");
sentFrames++;
}
AVRational time_base = _pInputFormatContext->streams[_inputStreamIndex]->time_base;
AVRational time_base_q = new AVRational();
time_base_q.num = 1;
time_base_q.den = ffmpeg.AV_TIME_BASE;
long pts_time = ffmpeg.av_rescale_q(frame.dts, time_base, time_base_q);
//long pts_time = ffmpeg.av_rescale_q(frame.dts, time_base_q, time_base);
long now_time = ffmpeg.av_gettime() - start_time;
if (pts_time > now_time)
ffmpeg.av_usleep((uint)(pts_time - now_time));
}
else
Console.WriteLine("????");
}
catch (Exception ex)
{
Console.WriteLine("Erro ao enviar: " + ex.Message);
}
finally
{
ffmpeg.av_packet_unref(pFrame);
}
}
}
catch (TaskCanceledException)
{
updateState(VideoStreamStates.Stopped);
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}
} -
FFMPEGmediametadataretriever not getting all frames from video
25 décembre 2019, par Zain AftabI am developing an application that takes a local video file and extracts its frames and write on disk. I am using
ffmpegmediametadataretriever
to extract frames from videos. I have done the following coderetriever.setDataSource(activity, uri);
Log.e("duration -> ", retriever.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION));
long duration = Long.parseLong(retriever.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION));
int everyNFrame = 1;
double frameRate = Double.parseDouble(retriever.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_FRAMERATE));
Log.e("all metadata", retriever.getMetadata().getAll().toString());
long sec = Math.round(1000 * 1000 / (frameRate));
Bitmap bitmap;
// Bitmap bitmap2;
// Log.e(" timeskip ", sec + " ----------- " + (frameRate * 1000));
for (long i = 1000; i < duration * 1000; i += sec)
// for (long i = sec; i < duration * 1000 && !stopWorking; i += sec)//30*sec)
// for(int i=1000000;iimg_" + (i) + ".jpg");
Log.e("filename->", path + "/img_" + i + ".jpg");
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
bitmap.recycle();
Thread.sleep(75);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}It is not extracting all the frames from the video. for some videos frames extracted are repeated. Random number of frames are extracted for different videos. for some videos, 70-80% frames are extracted and for some only 15-20 frames are extracted.
I have gone through all the answers I could find on StackOverflow and other websites to find a solution but the issue is there.