
Recherche avancée
Autres articles (56)
-
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 (...) -
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 (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (5029)
-
NV12 textures not working in DirectX 11.1
28 mars 2017, par André VitorI’m trying to render NV12 textures from frames decoded with ffmpeg 2.8.11 using DirectX 11.1 but when I do render them the texture is broken and the color is always off.
Result is : http://imgur.com/a/YIVQk
Code below is how I get the frame decoded by ffmpeg that is in YUV420P format and then I convert(not sure) to NV12 format by interleaving the U and V planes.
static uint8_t *pixelsPtr_ = nullptr;
UINT rowPitch = ((width + 1) >> 1) * 2;
UINT imageSize = (rowPitch * height) + ((rowPitch * height + 1) >> 1);
if (!pixelsPtr_)
{
pixelsPtr_ = new uint8_t[imageSize];
}
int j, position = 0;
uint32_t pitchY = avFrame.linesize[0];
uint32_t pitchU = avFrame.linesize[1];
uint32_t pitchV = avFrame.linesize[2];
uint8_t *avY = avFrame.data[0];
uint8_t *avU = avFrame.data[1];
uint8_t *avV = avFrame.data[2];
::SecureZeroMemory(pixelsPtr_, imageSize);
for (j = 0; j < height; j++)
{
::CopyMemory(pixelsPtr_ + position, avY, (width));
position += (width);
avY += pitchY;
}
for (j = 0; j < height >> 1; j++)
{
::CopyMemory(pixelsPtr_ + position, avU, (width >> 1));
position += (width >> 1);
avU += pitchU;
::CopyMemory(pixelsPtr_ + position, avV, (width >> 1));
position += (width >> 1);
avV += pitchV;
}This is how I’m creating the Texture2D with the data I just got.
// Create texture
D3D11_TEXTURE2D_DESC desc;
desc.Width = width;
desc.Height = height;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_NV12;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA initData;
initData.pSysMem = pixelsPtr_;
initData.SysMemPitch = rowPitch;
ID3D11Texture2D* tex = nullptr;
hr = d3dDevice->CreateTexture2D(&desc, &initData, &tex);
if (SUCCEEDED(hr) && tex != 0)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
memset(&SRVDesc, 0, sizeof(SRVDesc));
SRVDesc.Format = DXGI_FORMAT_R8_UNORM;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
SRVDesc.Texture2D.MipLevels = 1;
hr = d3dDevice->CreateShaderResourceView(tex, &SRVDesc, &textureViewYUV[0]);
if (FAILED(hr))
{
tex->Release();
return hr;
}
SRVDesc.Format = DXGI_FORMAT_R8G8_UNORM;
hr = d3dDevice->CreateShaderResourceView(tex, &SRVDesc, &textureViewYUV[1]);
if (FAILED(hr))
{
tex->Release();
return hr;
}
tex->Release();
}Then I pass both Shader Resource View to Pixel Shader
graphics->Context()->PSSetShaderResources(0, 2, textureViewYUV);
This is the pixel shader :
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float4 Color : COLOR;
float2 texCoord : TEXCOORD;
};
static const float3x3 YUVtoRGBCoeffMatrix =
{
1.164383f, 1.164383f, 1.164383f,
0.000000f, -0.391762f, 2.017232f,
1.596027f, -0.812968f, 0.000000f
};
Texture2D<float> luminanceChannel;
Texture2D<float2> chrominanceChannel;
SamplerState linearfilter
{
Filter = MIN_MAG_MIP_LINEAR;
};
float3 ConvertYUVtoRGB(float3 yuv)
{
// Derived from https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx
// Section: Converting 8-bit YUV to RGB888
// These values are calculated from (16 / 255) and (128 / 255)
yuv -= float3(0.062745f, 0.501960f, 0.501960f);
yuv = mul(yuv, YUVtoRGBCoeffMatrix);
return saturate(yuv);
}
float4 main(PixelShaderInput input) : SV_TARGET
{
float y = luminanceChannel.Sample(linearfilter, input.texCoord);
float2 uv = chrominanceChannel.Sample(linearfilter, input.texCoord);
float3 YUV = float3(y, uv.x, uv.y);
float4 YUV4 = float4(YUV.x, YUV.y, YUV.z, 1);
float3 RGB = ConvertYUVtoRGB(YUV);
float4 RGB4 = float4(RGB.x, RGB.y, RGB.z, 1);
return RGB4;
}
</float2></float>Can someone help me ? What I’m doing wrong ?
EDIT #1
int skipLineArea = 0;
int uvCount = (height >> 1) * (width >> 1);
for (j = 0, k = 0; j < uvCount; j++, k++)
{
if (skipLineArea == (width >> 1))
{
k += pitchU - (width >> 1);
skipLineArea = 0;
}
pixelsPtr_[position++] = avU[k];
pixelsPtr_[position++] = avV[k];
skipLineArea++;
}EDIT #2
Updating the texture instead of creating new ones
D3D11_MAPPED_SUBRESOURCE mappedResource;
d3dContext->Map(tex, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
uint8_t* mappedData = reinterpret_cast(mappedResource.pData);
for (UINT i = 0; i < height * 1.5; ++i)
{
memcpy(mappedData, frameData, rowPitch);
mappedData += mappedResource.RowPitch;
frameData += rowPitch;
}
d3dContext->Unmap(tex, 0); -
create Accord.Video.FFMPEG object intial error
14 mars 2018, par lokcyiI create an project with C# Visual studio 2013 and reference Accord.Video.FFMPEG.dll.
The Configure of projects Target Platforms is set to x86.
It is ok while compileing.
But,It would throw run time error when application running.
The exception is below. showing =>This application cannot be run in 64-bits
I have no idea what wrong with the error ?System.TypeInitializationException IsTransient=false
Message='<module>' 的型別初始設定式發生例外狀況。
Source=VideoMarkerAccord
TypeName=<module>
StackTrace:
於 VideoMarker.Form1.test()
於 VideoMarker.Form1.ConvertVedio(Int32 iFps, Int32 bitrate, Int32 width, Int32 height, Int32 iSpeed, String sOutputPath, String xml, String sVCode) 於 d:\Projects\AForge\VideoMarkerAccord\VideoMarker\Form1.cs: 行 201
於 VideoMarker.Form1.btnConvertVedio_Click(Object sender, EventArgs e) 於 d:\Projects\AForge\VideoMarkerAccord\VideoMarker\Form1.cs: 行 181
於 System.Windows.Forms.Control.OnClick(EventArgs e)
於 System.Windows.Forms.Button.OnClick(EventArgs e)
於 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
於 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
於 System.Windows.Forms.Control.WndProc(Message& m)
於 System.Windows.Forms.ButtonBase.WndProc(Message& m)
於 System.Windows.Forms.Button.WndProc(Message& m)
於 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
於 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
於 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
於 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
於 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
於 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
於 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
於 System.Windows.Forms.Application.Run(Form mainForm)
於 VideoMarker.Program.Main() 於 d:\Projects\AForge\VideoMarkerAccord\VideoMarker\Program.cs: 行 18
於 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
於 System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
於 System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
於 System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
於 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
於 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
於 System.Activator.CreateInstance(ActivationContext activationContext)
於 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
於 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
於 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
於 System.Threading.ThreadHelper.ThreadStart()
InnerException: <crtimplementationdetails>.ModuleLoadException
_HResult=-2146233088
_message=The C++ module failed to load during process initialization.
IsTransient=false
Message=The C++ module failed to load during process initialization.
Source=msvcm90
StackTrace:
於 <crtimplementationdetails>.ThrowModuleLoadException(String errorMessage, Exception innerException)
於 <crtimplementationdetails>.ThrowModuleLoadException(String , Exception )
於 <crtimplementationdetails>.LanguageSupport.Initialize(LanguageSupport* )
於 .cctor()
InnerException: System.InvalidOperationException
_HResult=-2146233079
_message=This application cannot be run in 64-bits.
IsTransient=false
Message=This application cannot be run in 64-bits.
Source=Accord.Video.FFMPEG
StackTrace:
於 _init.{ctor}(_init* )
於 ?A0xbe509209.??__E?A0xbe509209@_initializer@@YMXXZ()
於 _initterm_m((fnptr)* pfbegin, (fnptr)* pfend)
於 <crtimplementationdetails>.LanguageSupport.InitializePerProcess(LanguageSupport* )
於 <crtimplementationdetails>.LanguageSupport._Initialize(LanguageSupport* )
於 <crtimplementationdetails>.LanguageSupport.Initialize(LanguageSupport* )
InnerException:
</crtimplementationdetails></crtimplementationdetails></crtimplementationdetails></crtimplementationdetails></crtimplementationdetails></crtimplementationdetails></crtimplementationdetails></module></module> -
ffmpeg error while converting to mp4 Error while opening encoder for output stream #0.0
20 mars 2016, par JoshI am trying to convert various file types to mp4 to be displayed using ffmpeg, but i keep getting the error :
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
Another piece that looks important is :
[libx264 @ 0x93caef0] broken ffmpeg default settings detected
[libx264 @ 0x93caef0] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x93caef0] preset usage : -vpre -vpre
[libx264 @ 0x93caef0] speed presets are listed in x264 —help
[libx264 @ 0x93caef0] profile is optional ; x264 defaults to high
The latest code I am running is :
ffmpeg -i source -s 320x240 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 -coder 0 -bf 0 -refs 1 -flags2 -wpred-dct8x8 -level 30 -maxrate 10M -bufsize 10M -acodec libfaac -ac 2 -ar 48000 -ab 192k destination
I have seen a few other people with this issue, but their fixes didn’t work for some reason.
In case it matters : ultimately this will be used in php, though I am trying to get it working first via putty
EDIT: : Here is the full thing as requested(using a wmv, have tested wmv and flv) :
~ >> ffmpeg -i path.wmv -s 320x240 -r 30000/1001 -b 200k -r 29.97 -bt 240k -vcodec libx264 -coder 0 -bf 0 -refs 1 -flags2 -wpred-dct8x8 -level 30 -maxrate 10M -bufsize 10M -acodec libfaac -ac 2 -ar 48000 -ab 192k path.mp4
FFmpeg version SVN-r26076, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 28 2012 17:55:47 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
configuration: --enable-version3 --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-avfilter --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --disable-ffplay --disable-indevs --disable-outdevs --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-mmx
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001)
Input #0, asf, from 'path.wmv':
Metadata:
SfOriginalFPS : 299
WMFSDKVersion : 11.0.6001.7000
WMFSDKNeeded : 0.0.0.0000
IsVBR : 0
title : Wildlife in HD
artist :
copyright : © 2008 Microsoft Corporation
comment : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
Duration: 00:00:30.09, start: 8.000000, bitrate: 6977 kb/s
Stream #0.0(eng): Audio: wmav2, 44100 Hz, 2 channels, s16, 192 kb/s
Stream #0.1(eng): Video: vc1, yuv420p, 1280x720, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc
File 'path.mp4' already exists. Overwrite ? [y/N] y
[buffer @ 0x9ce9eb0] w:1280 h:720 pixfmt:yuv420p
[scale @ 0x9ce8f70] w:1280 h:720 fmt:yuv420p -> w:320 h:240 fmt:yuv420p flags:0x4
[libx264 @ 0x9ce9ef0] broken ffmpeg default settings detected
[libx264 @ 0x9ce9ef0] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x9ce9ef0] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x9ce9ef0] speed presets are listed in x264 --help
[libx264 @ 0x9ce9ef0] profile is optional; x264 defaults to high
Output #0, mp4, to 'path.mp4':
Stream #0.0(eng): Video: libx264, yuv420p, 320x240, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: libfaac, 48000 Hz, 2 channels, s16, 192 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
</profile></speed>Thanks for any help