
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 (69)
-
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 (6654)
-
How to get video pixel location from screen pixel location ?
22 février 2024, par AmLearningWall of Text so I tried breaking it up into sections to make it better sorry in advance


The problem


I have some video files that I am reading with ffmpeg to get the colors at specific pixels, and all seems well, but I just ran into a problem with finding the right pixel to input. I realized (or mistakingly believe) that the pixel location (x,y) on the screen will be different than the local pixel location so to speak of the video (ie. If I want to get pixel 50,0 of the video that will be different than my screen's pixel 50,0 because the resolutions don't match). I was trying to think of a way to convert my screen's pixel location into the "local pixel location", and I have two ideas but I am not sure if any of them is any good. Note I am currently using cmd+shift+4 on macos to get the screen coordinates and the video is playing fullscreen like in the screenshot below.


Ideas


- 

-
If I manually measure and account for this vertical offset, would it effectively convert the screen coordinate into the "local" one ?


-
If I instead adjust my
SwsContext
to put the destination height and width as that of my screen, will it effectively replace the need to convert screen coordinates to the video coordinates ?







Problems with the Ideas


The problems I see with the first solution are that I am assuming there is no hidden horizontal offset (or conversely that all of the width of the video is actually renderable on the screen). Additionally, this solution would only get an approximate result as I would need to manually measure the offsets, screen width, and screen height using the method I currently am using to get the screen coordinates.


With the second solution, aside from the question of if it will even work, the problem becomes that I can no longer measure what the screen coordinates I want are because I can't seem to get rid of those black bars in VLC.


Some Testing I did


Given that if the black bars are part of the video itself, my entire problem would be fixed (maybe ?) I tried seeing if the black bars were part of the video, and when I looked at the frame data's first pixel, it was black. The problem then is that if the black bars are entirely part of the video, then why are the colors I get for some pixels slightly off (I am checking with ColorSync Utility). These colors aren't just slightly off as in wrong but it seems more that they belong to a slightly offset region of the video.


However, this may be somewhat explained if ffmpeg reads right to left. When I put the top left corner of the video into the program and looked again at the pixel data in the frame for that location (location again was calculated by assuming the video location would be the same as the screen location) instead of getting white, I got a bluish color much like the glove in the top right corner.


The Watered Down Code


struct SwsContext *rescaler = NULL;
 rescaler = sws_getContext(codec_context->width, codec_context->height, codec_context->pix_fmt, codec_context->width, codec_context->height, AV_PIX_FMT_RGB0, SWS_FAST_BILINEAR, NULL, NULL, 0);

// Get Packets (containers for frames but not guaranteed to have a full frame) and Frames
 while (av_read_frame(avformatcontext, packet) >= 0)
 {
 
 // determine if packet is video packet
 if (packet->stream_index != video_index)
 {
 continue;
 }
 
 // send packet to decoder
 if (avcodec_send_packet(codec_context, packet) < 0)
 {
 perror("Failed to decode packet");
 }
 
 // get frame from decoder
 int response = avcodec_receive_frame(codec_context, frame);
 if (response == AVERROR(EAGAIN))
 {
 continue;
 }
 else if (response < 0)
 {
 perror("Failed to get frame");
 }
 
 // convert frame to RGB0 colorspace 4 bytes per pixel 1 per channel
 response = sws_scale_frame(rescaler, scaled_frame, frame);
 if(response < 0){
 perror("Failed to change colorspace");
 }
 // get data and write it
 int pixel_number = y*(scaled_frame->linesize[0]/4)+x; // divide by four gets pixel linesize (4 byte per pixel)
 int byte_number = 4*(pixel_number-1); // position of pixel in array
 // start of debugging things
 int temp = scaled_frame->data[0][byte_number]; // R
 int one_after = scaled_frame->data[0][byte_number+1]; // G
 int two_after = scaled_frame->data[0][byte_number+2]; // B
 int als; // where i put the breakpoint
 // end of debugging things
 }



In Summary


I have no idea what is happening.


I take the data for a pixel and compare it to what colorsync utility says should be there, but it is always slightly off as though the pixel I was actually reading was offset from what I thought I was reading. Therefore, I want to find a way to get the pixel location in a video given a screen coordinate when the video is in fullscreen, but I have no idea how to (aside from a few ideas that are probably bad at best).


Also does FFMPEG put the frame data right to left ?


A Video Better Showing My Problem


https://www.youtube.com/watch?v=NSEErs2lC3A


-
-
Revision 31957 : légère amélioration ... Un peu de documentation dans le code également
7 octobre 2009, par kent1@… — Loglégère amélioration ...
Un peu de documentation dans le code également -
C++/CLI — 0xc000007b (INVALID_IMAGE_FORMAT) with /clr option on
9 mars 2015, par OverMachoGrandeI’m trying to build a C++/CLI executable to which I statically link ffmpeg (libavcodec, libavformat, libavutil & swscale). It works fine if I build it normally (without /clr, so no CLR support), it works. However, when I add CLR support, it won’t start up with a 0xc000007b. A "Hello World" C++/CLI app runs fine, though.
Supposedly the same thing happens with Boost::Threads, but since ffmpeg is pure C, I doubt it’s using Boost.
My config :
- Visual Studio 2008 Professional SP1
- Windows XP Pro SP3 (x86)
- .NET Framework 3.5 SP1
Thanks,
Robert