
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 (96)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
Sur d’autres sites (7276)
-
Video too fast FFmpeg
22 novembre 2012, par SpamdarkI am having an issue again with ffmpeg, I'm a newbie with ffmpeg, and I can't find a good tutorial up to date...
This time, when I play a video with ffmpeg, it plays too fast, ffmpeg is ignoring the FPS, I don't want to handle that with a thread sleep, because the videos have differents FPS's.
I created a thread, there you can find the loop :
AVPacket framepacket;
while(av_read_frame(formatContext,&framepacket)>= 0){
pausecontrol.lock();
// Is it a video or audio frame¿?
if(framepacket.stream_index==gotVideoCodec){
int framereaded;
// Video? Ok
avcodec_decode_video2(videoCodecContext,videoFrame,&framereaded,&framepacket);
// Yeah, did we get it?
if(framereaded && doit){
AVRational millisecondbase = {1,1000};
int f_number = framepacket.dts;
int f_time = av_rescale_q(framepacket.dts,formatContext->streams[gotVideoCodec]->time_base,millisecondbase);
currentTime=f_time;
currentFrameNumber=f_number;
int stWidth = videoCodecContext->width;
int stHeight = videoCodecContext->height;
SwsContext *ctx = sws_getContext(stWidth, stHeight, videoCodecContext->pix_fmt, stWidth,
stHeight, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
if(ctx!=0){
sws_scale(ctx,videoFrame->data,videoFrame->linesize,0,videoCodecContext->height,videoFrameRGB->data,videoFrameRGB->linesize);
QImage framecapsule=QImage(stWidth,stHeight,QImage::Format_RGB888);
for(int y=0;ydata[0]+y*videoFrameRGB->linesize[0],stWidth*3);
}
emit newFrameReady(framecapsule);
sws_freeContext(ctx);
}
}
}
if(framepacket.stream_index==gotAudioCodec){
// Audio? Ok
}
pausecontrol.unlock();
av_free_packet(&framepacket);
}Any Idea ?
-
File encoded as FFV1 with libavcodec is unplayable
19 novembre 2016, par Ali AlidoustI’m using the following code to encode a series of frames into an mkv or avi file with FFV1 encoding :
HRESULT Session::createContext(LPCSTR filepath, UINT width, UINT height, UINT fps_num, UINT fps_den) {
LOG(filepath);
this->codec = avcodec_find_encoder(AV_CODEC_ID_FFV1);
RET_IF_NULL(this->codec, "Could not create codec", E_FAIL);
this->oformat = av_guess_format(NULL, filepath, NULL);
RET_IF_NULL(this->oformat, "Could not create format", E_FAIL);
this->oformat->video_codec = AV_CODEC_ID_FFV1;
this->width = width;
this->height = height;
this->context = avcodec_alloc_context3(this->codec);
RET_IF_NULL(this->context, "Could not allocate context for the codec", E_FAIL);
this->context->codec = this->codec;
this->context->codec_id = AV_CODEC_ID_FFV1;
this->context->codec_type = AVMEDIA_TYPE_VIDEO;
this->context->pix_fmt = AV_PIX_FMT_YUV420P;
this->context->width = this->width;
this->context->height = this->height;
this->context->time_base.num = fps_den;
this->context->time_base.den = fps_num;
this->context->gop_size = 1;
av_opt_set_int(this->context->priv_data, "coder", 0, 0);
av_opt_set_int(this->context->priv_data, "context", 1, 0);
av_opt_set_int(this->context->priv_data, "slicecrc", 1, 0);
avformat_alloc_output_context2(&fmtContext, NULL, NULL, filepath);
this->fmtContext->oformat = this->oformat;
this->fmtContext->video_codec_id = AV_CODEC_ID_FFV1;
this->stream = avformat_new_stream(this->fmtContext, this->codec);
RET_IF_NULL(this->fmtContext, "Could not create new stream", E_FAIL);
avcodec_parameters_from_context(this->stream->codecpar, this->context);
this->stream->codecpar->level = 3;
/*if (this->fmtContext->oformat->flags & AVFMT_GLOBALHEADER)
{*/
this->context->flags |= CODEC_FLAG_GLOBAL_HEADER;
/*}*/
RET_IF_FAILED_AV(avcodec_open2(this->context, this->codec, NULL), "Could not open codec", E_FAIL);
RET_IF_FAILED_AV(avio_open(&this->fmtContext->pb, filepath, AVIO_FLAG_READ_WRITE), "Could not open output file", E_FAIL);
RET_IF_NULL(this->fmtContext->pb, "Could not open output file", E_FAIL);
RET_IF_FAILED_AV(avformat_write_header(this->fmtContext, NULL), "Could not write header", E_FAIL);
frame = av_frame_alloc();
RET_IF_NULL(frame, "Could not allocate frame", E_FAIL);
frame->format = this->context->pix_fmt;
frame->width = width;
frame->height = height;
// RET_IF_FAILED(av_image_alloc(frame->data, frame->linesize, context->width, context->height, context->pix_fmt, 32), "Could not allocate image", E_FAIL);
return S_OK;
}
HRESULT Session::writeFrame(IMFSample * pSample) {
IMFMediaBuffer *mediaBuffer = NULL;
BYTE *pData = NULL;
DWORD length;
RET_IF_FAILED(pSample->ConvertToContiguousBuffer(&mediaBuffer), "Could not convert IMFSample to contagiuous buffer", E_FAIL);
RET_IF_FAILED(mediaBuffer->GetCurrentLength(&length), "Could not get buffer length", E_FAIL);
RET_IF_FAILED(mediaBuffer->Lock(&pData, NULL, NULL), "Could not lock the buffer", E_FAIL);
RET_IF_FAILED(av_image_fill_arrays(frame->data, frame->linesize, pData, AV_PIX_FMT_YUV420P, this->width, this->height, 1), "Could not fill the frame with data from the buffer", E_FAIL);
LOG_IF_FAILED(mediaBuffer->Unlock(), "Could not unlock the buffer");
frame->pts = this->pts++;
AVPacket pkt;
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
RET_IF_FAILED_AV(avcodec_send_frame(this->context, frame), "Could not send the frame to the encoder", E_FAIL);
if (SUCCEEDED(avcodec_receive_packet(this->context, &pkt))) {
RET_IF_FAILED_AV(av_interleaved_write_frame(this->fmtContext, &pkt), "Could not write the received packet.", E_FAIL);
}
av_packet_unref(&pkt);
return S_OK;
}
HRESULT Session::endSession() {
LOG("Ending session...");
LOG("Closing files...");
av_write_trailer(this->fmtContext);
avio_close(this->fmtContext->pb);
avcodec_close(this->context);
av_free(this->context);
//fclose(this->file);
LOG("Done.");
return S_OK;
}The problem is that the generated file is not playable in either VLC or MPC-HC. However, MPC-HC reports following info in file properties :
General
Unique ID : 202978442142665779317960161865934977227 (0x98B439D9BE859109BD5EC00A62A238CB)
Complete name : T:\Test.mkv
Format : Matroska
Format version : Version 4 / Version 2
File size : 24.6 MiB
Duration : 147ms
Overall bit rate : 1 401 Mbps
Writing application : Lavf57.57.100
Writing library : Lavf57.57.100
Video
ID : 1
Format : FFV1
Format version : Version 0
Codec ID : V_MS/VFW/FOURCC / FFV1
Duration : 147ms
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 1 000.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Compression mode : Lossless
Default : Yes
Forced : No
DURATION : 00:00:00.147000000
coder_type : Golomb RiceSomething to note is that it reports 1000 FPS which is weird since I’ve set
AVCodecContext::time_base
in the code.UPDATE :
I managed to set the correct fps by setting
time_base
property of the stream :this->stream->time_base.den = fps_num;
this->stream->time_base.num = fps_den;VLC plays the output file but it shows VLC logo instead of the video, as if there is no video stream in the file.
-
Copy C++ FFmpeg AVFrame to C# WritableBitmap
2 janvier 2023, par SpurigaI have a C++ function definition with ffmpeg scaler The last two parameter is my question (buffer and stride) :


int scale_decoded_video_frame(void* handle, void* scalerHandle, void* scaledBuffer, int scaledBufferStride) 

sws_scale(
 scalerContext->sws_context,
 srcData,
 context->frame->linesize,
 0, 
 scalerContext->source_height,
 reinterpret_cast(&scaledBuffer),
 &scaledBufferStride);



When I declared it in C# I use the following code :


[DllImport(LibraryName, EntryPoint = "scale_decoded_video_frame", CallingConvention = CallingConvention.Cdecl)]
public static extern int ScaleDecodedVideoFrame(IntPtr handle, IntPtr scalerHandle, IntPtr scaledBuffer, int scaledBufferStride);



And the C# call :


WriteableBitmap w = new WriteableBitmap(1920, 1080, 96, 96, PixelFormats.Pbgra32, null);
RenderOptions.SetBitmapScalingMode(w, BitmapScalingMode.NearestNeighbor);
w.Lock();

Int32Rect rect = new Int32Rect(0, 0, 1920, 1080);

resultCode = FFmpegVideoPInvoke.ScaleDecodedVideoFrame(decoderPtr, scalerHandle, w.BackBuffer, w.BackBufferStride);
if (resultCode == 0)
 w.AddDirtyRect(rect);

w.Unlock();



It works perfect, but I want to skip the scale function and only want to get the decoded image to the WritableBitmap buffer. I try to use this code, change the sws_scale function to memcpy, but it shows nothing. The context->frame is AVFrame*.


memcpy(scaledBuffer, context->frame->data, AV_NUM_DATA_POINTERS * sizeof(uint8_t));
memcpy(&scaledBufferStride, context->frame->linesize, AV_NUM_DATA_POINTERS * sizeof(int));



How can I copy the AVFrame buffer to the WritableBitmap buffer ?