
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 (39)
-
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 -
Les statuts des instances de mutualisation
13 mars 2010, parPour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...) -
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) (...)
Sur d’autres sites (7047)
-
YUV4:2:0 conversion to RGB outputs overly green image
27 février 2023, par luckybromaI'm decoding video and getting YUV 420 frames. In order to render them using D3D11, they need to get converted to RGB (or at least I assume that the render target view cannot be YUV itself).


The YUV frames are all in planar format, meaning UV and not packed. I'm creating 3 textures and ShaderResourceViews of type
DXGI_FORMAT_R8G8_UNORM
. I'm copying each plane from the frame into it's own ShaderResourceView. I'm then relying on the sampler to account for the differences in size between the Y and UV planes. Black/White only looks great. If I add in color though, I get an overly Green Picture :


I'm at a huge loss of what I could be doing wrong.. I've tried switching the UV and planes around, I've also tried tweaking the conversion values. I'm following Microsoft's guide on picture conversion.


Here is my shader :


min16float4 main(PixelShaderInput input) : SV_TARGET
{
 float y = YChannel.Sample(defaultSampler, input.texCoord).r;
 float u = UChannel.Sample(defaultSampler, input.texCoord).r - 0.5;
 float v = VChannel.Sample(defaultSampler, input.texCoord).r - 0.5;

 float r = y + 1.13983 * v;
 float g = y - 0.39465 * u - 0.58060 * v;
 float b = y + 2.03211 * u;

 return min16float4(r, g, b , 1.f);
}



Creating my ShaderResourceViews :


D3D11_TEXTURE2D_DESC texDesc;
 ZeroMemory(&texDesc, sizeof(texDesc));
 texDesc.Width = 1670;
 texDesc.Height = 626;
 texDesc.MipLevels = 1;
 texDesc.ArraySize = 1;
 texDesc.Format = DXGI_FORMAT_R8_UNORM;
 texDesc.SampleDesc.Count = 1;
 texDesc.SampleDesc.Quality = 0;
 texDesc.Usage = D3D11_USAGE_DYNAMIC;
 texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
 texDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;


 dev->CreateTexture2D(&texDesc, NULL, &pYPictureTexture);
 dev->CreateTexture2D(&texDesc, NULL, &pUPictureTexture);
 dev->CreateTexture2D(&texDesc, NULL, &pVPictureTexture);
 
 D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc;
 shaderResourceViewDesc.Format = DXGI_FORMAT_R8_UNORM;
 shaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
 shaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
 shaderResourceViewDesc.Texture2D.MipLevels = 1;

 dev->CreateShaderResourceView(pYPictureTexture, &shaderResourceViewDesc, &pYPictureTextureResourceView);

 dev->CreateShaderResourceView(pUPictureTexture, &shaderResourceViewDesc, &pUPictureTextureResourceView);
 
 dev->CreateShaderResourceView(pVPictureTexture, &shaderResourceViewDesc, &pVPictureTextureResourceView);




And then How I'm copying the decoded ffmpeg AVFrames :


int height = 626;
 int width = 1670; 

 D3D11_MAPPED_SUBRESOURCE msY;
 D3D11_MAPPED_SUBRESOURCE msU;
 D3D11_MAPPED_SUBRESOURCE msV;
 devcon->Map(pYPictureTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &msY);

 memcpy(msY.pData, frame->data[0], height * width);
 devcon->Unmap(pYPictureTexture, 0);

 devcon->Map(pUPictureTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &msU);
 memcpy(msU.pData, frame->data[1], (height*width) / 4);
 devcon->Unmap(pUPictureTexture, 0);


 devcon->Map(pVPictureTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &msV);
 memcpy(msV.pData, frame->data[2], (height*width) / 4);
 devcon->Unmap(pVPictureTexture, 0);



PS : Happy to provide any more additional requested code ! I just wanted to be concise as possible.


-
VB.Net Stream Bitmap/Image TO FFMpeg is not working :(
6 février 2015, par Zakir_SZHI m trying to port images to FFMpeg using StandardInput. It’s not working somehow ? :(
it’s throwing me bellow error :(
Here is the code i tried :
Dim objBitmap As System.Drawing.Bitmap
Dim objFProcess As System.Diagnostics.Process
Dim objStream As System.IO.BinaryWriter
Dim strFiles() As String
Dim strEachFile As String
Dim intFile As Integer
Dim intFrame As Integer
Dim intFLoop As Integer
objFProcess = New System.Diagnostics.Process
objFProcess.StartInfo.FileName = "c:\ffmpeg.exe"
objFProcess.StartInfo.Arguments = "-r 1 -f image2pipe -i pipe:.bmp -pix_fmt yuv420p -crf 35.0 -vcodec libx264 -an -coder 1 -rc_lookahead 50 -threads 0 D:\test.mp4"
objFProcess.StartInfo.UseShellExecute = False
objFProcess.StartInfo.RedirectStandardInput = True
objFProcess.StartInfo.RedirectStandardOutput = True
objFProcess.StartInfo.RedirectStandardError = True
rem objFProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
rem objFProcess.StartInfo.CreateNoWindow = True
objFProcess.Start()
objStream = New System.IO.BinaryWriter(objFProcess.StandardInput.BaseStream)
strFiles = My.Computer.Clipboard.GetText().Split({System.Environment.NewLine}, StringSplitOptions.None)
intFrame = 0
intFile = 0
For Each strEachFile In strFiles
rem MessageBox.Show(strEachFile)
intFile = intFile + 1
objBitmap = New System.Drawing.Bitmap(strEachFile)
For intFLoop = 0 To 24
intFrame = intFrame + 1
cmd1.Text = intFile.ToString & "-" & intFrame.ToString
My.Application.DoEvents()
objBitmap.Save(objStream.BaseStream, System.Drawing.Imaging.ImageFormat.Bmp) Rem this line give me above (attached) error :(
Next
objBitmap.Dispose()
Next
System.Threading.Thread.Sleep(3000)
objStream.Close()
MessageBox.Show("Done!")
rem objFProcess.Kill()any help would be highly appreciated
thanks in advance...
Edit-1 :
As asked by some one :) here is :View Detail Result : (Sorry, the image is very large in width/height)
And here is the Copy Details Result :
System.Runtime.InteropServices.ExternalException was unhandled
ErrorCode=-2147467259
Message=A generic error occurred in GDI+.
Source=System.Drawing
StackTrace:
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at FFMpeg_Stream.Form1.cmd1_Click(Object sender, EventArgs e) in g:\My Documents\FFMpeg Stream\FFMpeg Stream\Form1.vb:line 40
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at FFMpeg_Stream.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:that’s all i can give as information :(
-
Problem compiling ffmpeg with nvenc using visual studio 2015 community edition
23 février 2020, par Uri RazI’m trying to build ffmpeg w/ nvenc on Windows 10 64 bit and visual studio 2015 community edition. The command from step 10 in the Using FFmpeg with NVIDIA GPU Hardware Acceleration doc :
./configure —enable-nonfree —enable-cuda-sdk —enable-libnpp –-toolchain=msvc —extra-cflags=-I../nv_sdk —extraldflags=-libpath :../nv_sdk
Gives me the error ’Unknown option "–-toolchain=msvc"’
Background : I’ve executed the commands (changed the path in the first, I’m not sure its right) :
export PATH="/C/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/" :$PATH
export PATH="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin/" :$PATHAnd ../nv_sdk has the subdirectories include & bin, copied from the NVIDIA GPU Computing Toolkit directory.