
Recherche avancée
Médias (91)
-
DJ Z-trip - Victory Lap : The Obama Mix Pt. 2
15 septembre 2011
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Matmos - Action at a Distance
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
DJ Dolores - Oslodum 2004 (includes (cc) sample of “Oslodum” by Gilberto Gil)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Danger Mouse & Jemini - What U Sittin’ On ? (starring Cee Lo and Tha Alkaholiks)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Cornelius - Wataridori 2
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Rapture - Sister Saviour (Blackstrobe Remix)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (65)
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
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 (10634)
-
Flash 9, non-NetStream/movieStar can detect when playback fails due to missing sound hardware support (or 32-channel sound ceiling being hit.) Implemented as SMSound.onplayerror() callback.
1er mai 2012, par Scott Schillerm script/soundmanager2-jsmin.js m script/soundmanager2-nodebug-jsmin.js m script/soundmanager2-nodebug.js m script/soundmanager2.js m src/SoundManager2.as m src/SoundManager2_AS3.as m src/SoundManager2_SMSound_AS3.as m swf/soundmanager2.swf m swf/soundmanager2_debug.swf m (...)
-
Delphi FFMPEG CUDA hardware accelerated video decoding generating shadows
30 janvier 2023, par EdimarI'm trying to use cuda hardware accelerated video decoding, loading from a .mp4 file, according to the code bellow, but getting the image with shadows


Specification :
FFMPEG 4.3
Delphi 10.3
NVIDIA GeForce RTX 3050 Laptop GPU 4Gb DDR6
Intel Core i5 11400H 16 Gb RAM


unit UVideoDecoding;

interface

uses
 Vcl.Graphics, Winapi.Windows,
 System.SysUtils, System.Classes,
 libavcodec, libavdevice,
 libavfilter, libswresample, libavformat, libavutil,
 libswscale;

type
 TDecoder = class
 protected
 fFormatCtx: PAVFormatContext;
 fCodec: PAVCodec;
 fCodecParams, fLocalCodecParams: PAVCodecParameters;
 fCodecCtx: libavcodec.PAVCodecContext;
 fPacket: PAVPacket;
 fFrameIn, fFrameOut: PAVFrame;
 fScaler: PSwsContext;
 fVideoStreamIndex: Integer;
 fHWPixelFormat: AVPixelFormat;
 fOutputWidth: Integer;
 fOutputHeight: Integer;

 function DecodeVideoPacket: Integer;
 public
 function Load(pFileName: string): Integer;

 end;
implementation

function TDecoder.Load(pFileName: string): Integer;
var
 vCount: Integer;
 vLocalCodec: PAVCodec;
 vFileName: AnsiString;
 vType: AVHWDeviceType;
 vDecPackResponse: Integer;
begin

 vType := av_hwdevice_find_type_by_name('cuda');
 {vType = AV_HWDEVICE_TYPE_CUDA}

 fFormatCtx := avformat_alloc_context;

 vFileName := AnsiString(pFileName);
 avformat_open_input(fFormatCtx, PAnsiChar(vFileName), nil, nil);

 avformat_find_stream_info(fFormatCtx, nil);

 for vCount := 0 to fFormatCtx.nb_streams - 1 do
 begin
 fLocalCodecParams := fFormatCtx.streams[vCount].codecpar;

 case fLocalCodecParams.codec_id of
 AVCodecID.AV_CODEC_ID_H264: vLocalCodec := avcodec_find_decoder_by_name('h264_cuvid');
 AVCodecID.AV_CODEC_ID_HEVC: vLocalCodec := avcodec_find_decoder_by_name('hevc_cuvid');
 AVCodecID.AV_CODEC_ID_MJPEG: vLocalCodec := avcodec_find_decoder_by_name('mjpeg_cuvid');
 AVCodecID.AV_CODEC_ID_MPEG4: vLocalCodec := avcodec_find_decoder_by_name('mpeg4_cuvid');
 else
 vLocalCodec := avcodec_find_decoder(fLocalCodecParams.codec_id);
 end;

 if fLocalCodecParams.codec_type = AVMEDIA_TYPE_VIDEO then
 begin
 fVideoStreamIndex := vCount;
 fCodec := vLocalCodec;
 fCodecParams := fLocalCodecParams;
 end;
 end;

 {fCodec.name = h264_cuvid} 

 fCodecCtx := avcodec_alloc_context3(fCodec);


 var vHWDeviceCtx: PAVBufferRef;
 try
 if av_hwdevice_ctx_create(vHWDeviceCtx, vType, nil, nil, 0) >= 0 then
 fCodecCtx.hw_device_ctx := av_buffer_ref(vHWDeviceCtx);
 finally
 av_buffer_unref(vHWDeviceCtx);
 end;

 avcodec_open2(fCodecCtx, fCodec, nil);
 {
 fCodecCtx.codec_id = AV_CODEC_ID_H264
 fCodecCtx.pix_fmt = AV_PIX_FMT_MMAL
 }

 fFrameIn := av_frame_alloc;
 fFrameOut := av_frame_alloc;
 fFrameOut.format := Integer(AV_PIX_FMT_BGRA);
 fFrameOut.width := 640;
 fFrameOut.height := 480;

//On getting sws_context I've tried srcFormat = AV_PIX_FMT_MMAL but the result was nil
 fScaler := sws_getContext(fCodecCtx.Width, fCodecCtx.Height, AV_PIX_FMT_NV12{fCodecCtx.pix_fmt},
 fOutputWidth, fOutputHeight, AV_PIX_FMT_BGRA, SWS_BILINEAR, nil, nil, nil);

 fPacket := av_packet_alloc;

 while (av_read_frame(fFormatCtx, fPacket) >= 0) do
 begin
 if fPacket.stream_index = fVideoStreamIndex then
 begin
 vDecPackResponse := DecodeVideoPacket;

 av_packet_unref(fPacket);

 if vDecPackResponse < 0 then
 Break;
 end
 end;

 Exit(0);
end; 

function TDecoder.DecodeVideoPacket: Integer;
var
 vResponse: Integer;
 vBmp: Vcl.Graphics.TBitmap;
 vScaleResult, vSize: Integer;
 vBuffer: PByte;
 vSWFrame, vTMPFrame: pAVFrame;
begin
 Result := 0;

 vResponse := avcodec_send_packet(fCodecCtx, fPacket);

 if vResponse < 0 then
 Exit(vResponse);

 while (vResponse >= 0) do
 begin
 vResponse := avcodec_receive_frame(fCodecCtx, fFrameIn);
 if (vResponse = AVERROR_EAGAIN) or (vResponse = AVERROR_EOF) then
 Break
 else if vResponse < 0 then
 Exit(vResponse);

 if vResponse >= 0 then
 begin
 vSWFrame := av_frame_alloc;

 if av_hwframe_transfer_data(vSWFrame, fFrameIn, 0) >= 0 then
 vTMPFrame := vSWFrame
 else
 vTMPFrame := fFrameIn;

 vSize := av_image_get_buffer_size(AVPixelFormat(vTMPFrame.format), vTMPFrame.width, vTMPFrame.height, 1);
 vBuffer := av_malloc(vSize);

 if Assigned(vBuffer) then
 av_image_copy_to_buffer(vBuffer, vSize, @vTMPFrame.data, @vTMPFrame.linesize, AVPixelFormat(vTMPFrame.format), vTMPFrame.width, vTMPFrame.height, 1);

 MoveMemory(vTMPFrame.data[0], vBuffer, vSize);

 vTMPFrame.data[0] := vTMPFrame.data[0] + vTMPFrame.linesize[0] * (fCodecCtx.height - 1);
 vTMPFrame.linesize[0] := vTMPFrame.linesize[0] * -1;
 vTMPFrame.data[1] := vTMPFrame.data[1] + vTMPFrame.linesize[1] * (fCodecCtx.height div 2 - 1);
 vTMPFrame.linesize[1] := vTMPFrame.linesize[1] * -1;
 vTMPFrame.data[2] := vTMPFrame.data[2] + vTMPFrame.linesize[2] * (fCodecCtx.height div 2 - 1);
 vTMPFrame.linesize[2] := vTMPFrame.linesize[2] * -1;

 vScaleResult := sws_scale(fScaler, @vTMPFrame.Data, @vTMPFrame.Linesize, 0,
 fCodecCtx.Height, @fFrameOut.data, @fFrameOut.Linesize);
 if vScaleResult <= 0 then
 begin
 Break;
 end;

 vBmp := Vcl.Graphics.TBitmap.Create;
 try
 vBmp.Height := fOutputHeight;
 vBmp.Width := fOutputWidth;
 vBmp.PixelFormat := TPixelFormat.pf32bit;

 MoveMemory(PByte(vBmp.ScanLine[vBmp.Height -1]),
 fFrameOut.data[0], fOutputHeight * fFrameOut.linesize[0]);

//Renders BMP on main thread
// if Assigned(fOnBitmap) then
// fOnBitmap(vBmp);
 finally
 av_frame_unref(vSWFrame);
 av_frame_free(vTMPFrame);
 av_freep(@vBuffer);
 FreeAndNil(vBmp);
 Result := 1;
 end;
 end;
 end;
end;

end.



I've tried using different pixelformats but none of them properly decoded the video.


-
Create a thumbnail with play icon inside with ffmpeg
14 décembre 2016, par somenxavierI want to create a thubnail with ffmpeg with a play inside (like a picture above ; taking from Dan Meyer site) for showing that it’s a video and not an image.