
Recherche avancée
Autres articles (74)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
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 -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)
Sur d’autres sites (9081)
-
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 :(
-
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.


-
riff : don’t overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn’t contain that data.
2 mai 2012, par Hendrik Leppkesriff : don’t overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn’t contain that data.
According to the specification on the MSDN [1], 0 is valid for that
particular field, and it should be ignored in that case.[1] : http://msdn.microsoft.com/en-us/library/windows/desktop/dd757714(v=vs.85).aspx
Bug-Id : 950
Signed-off-by : Anton Khirnov <anton@khirnov.net>