
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (37)
-
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 -
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 -
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 (3262)
-
Evolution #4727 : Des pictos / icônes symboliques pour tout le monde
13 avril 2021, par nicod _Comme je disais, en SCSS j’ai une mixin qui me permet des trucs comme ça, ce qui transforme :
.machin position : relative ; &:after content :’’ ; position : absolute ; right : -1em ; top : 50% ; transform : translateY(-50%) ; width : 7px ; height : 7px ; background : svg-url(’’) center no-repeat ;
mais bon, on va peut être pas mettre scssphp dans la dist...
-
FFMpeg - Trimming out the video after removing duplicate frames
29 avril 2021, par MarianDI removed many duplicate frames from video (and completely removed audio) by this command



ffmpeg -i scene.mkv -vf mpdecimate,setpts=N/FRAME_RATE/TB -map:v 0 scene3.mp4




(by an Mulvya's answer, thanks again).



The resulting video is OK but the total duration will not change - the last frame of original video is frozen to fill the remaining time (when playing back the video).



Is there some way to trim the video so that it will finish at this last frame ?


-
File encoded as FFV1 with ffmpeg is unplayable
18 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_num;
this->context->time_base.den = fps_den;
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.