Recherche avancée

Médias (0)

Mot : - Tags -/diogene

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (60)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

Sur d’autres sites (6854)

  • Surfaceview for subtitles alpha does not work

    27 mai 2018, par user654628

    Goal : trying to build video player with subtitles for android. Video can be low resolution but the subtitles should be resolution of phone (such that if video is 720p, the subtitles should render to screen size say 1080p).

    Issue : I am using FFMPEG to render a frame at say 720p but phone device is 1080p. I need to display subtitles that are different resolution than the subtitles resolution so pixel blending is difficult.

    I first tried to scale the frame (AVFrame) with sws_convert but each frame took 80ms so that is not an option (since it is running software).

    Then I tried two surface views, one for the video and one for subtitles where video would be 720p and subtitles SurfaceView is 1080p, then the video scales up to the phone size. The issue here is that the subtitles are not translucent. Black opacity 0 would be transparent but white with alpha 0 is still white. Why is this ?

    //Code from Java, the view that extends FrameLayout
    public VideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
       super(context, attrs, defStyleAttr);
       mVideoSurface = new SurfaceView(context);
       mSubtitlesSurface = new SurfaceView(context);
       addView(mVideoSurface);
       addView(mSubtitlesSurface);
       mVideoSurface.getHolder().addCallback(mSurfaceCallback);
       mSubtitlesSurface.getHolder().addCallback(mSurfaceCallback);
       mSubtitlesSurface.setZOrderMediaOverlay(true);
       mSubtitlesSurface.getHolder().setFormat(PixelFormat.TRANSLUCENT);
       //etc
    }

    Eventually I tried as a test to render a square to the subtitle surface view (C++)

    // Render the video frame, now render the subtitle frame
    ANativeWindow_Buffer buffer;
    ANativeWindow_setBuffersGeometry(subWindow, width, height, WINDOW_FORMAT_RGBA_8888);
    if ((ret = ANativeWindow_lock(subWindow, &buffer, NULL)) < 0) {
       return ret;
    }
    for (int j = height/2; j < height/2 + 100; j++) {
       for (int i = width/2; i < width/2 + 100; i++) {
           uint8_t * d =  (uint8_t*)buffer.bits + j * (buffer.stride * 4) + i * 4;
           d[0] = 0xff;
           d[1] = 0xff;
           d[2] = 0xFF;
           d[3] = 0;           /* alpha */

       }
    }
    ANativeWindow_unlockAndPost(subWindow);

    So above code should render a white square in the image with 0 alpha (so should be invisible), but it is shown. If I change it to yellow with alpha 0 it will be visible but not the correct color. If I change to white with 1 alpha, it is white and opaque. If I use black with alpha 0xCC, it is invisible, only if alpha is 0xFF then it is visible as black. Seems to have no translucency even though I added it to the SurfaceHolder. Why is it like this ? I can add more code if needed.

    Is my only option to do what I want to render frame as a texture in OpenGL and (GLSurfaceView), resize the image to phone resolution and blend the alpha subtitles onto the frame as a texture ?

    Thanks in advance.

  • Convert wav file from WAV_FORMAT_EXTENSIBLE to WAV_FORMAT_PCM

    22 juillet 2022, par michaeljan

    I have a 16-bit 44.1kHz wav file in WAV_FORMAT_EXTENSIBLE format. What is a simple and efficient way to convert it to WAV_FORMAT_PCM on the command-line ?

    


    In case it helps, here's a sample file. It's (a part of) a file that a client sent to me, so I'm not sure how it was created. But it is understood by ffmpeg and playable by VLC.

    


    Also, I've seen this question, but it's 7 years old and the accepted answer doesn't answer the question. Also, that question asks for ffmpeg-only solutions, whereas I am open to other command-line solutions as well. (Although I do prefer ffmpeg.)

    


  • OpenCV and Cloud Cameras

    8 mai 2014, par Alexander

    So as a bit of context ; this program was built originally to work with USB cameras - but a few things changed. I’m trying to convert it to work with networked cameras, but my presence here should make it quite apparent what my level of success has been. I still consider myself somewhat new at programming, and definately new at visual processing/OpenCV - so please forgive a few blunders if I make them. I’m going to try to provide as much detail as possible, so apologies for the length below.


    I’m using :

    • OpenCV 2.4.6.0
    • Microsoft Visual Studio Express 2012
    • C++
    • D-Link Cloud Camera 7100

    I am trying to access the DLink camera’s video feed through OpenCV.

    I can access the camera through it’s IP address with a browser without any issues. Unfourtunately ; my program is less cooperative. I’ve put it on two computers (excluding the computer it gets compiled on, which for unrelated/unchangable reasons cannot be placed on the same network the network camera is on) which both fail to grant my program access to the camera. One computer gives the OpenCV-generated error :

    warning : Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:529)

    This error occurs with just about everything I try that doesn’t somehow generate more problems. The other computer (same code) generates no such error - it just doesn’t get the camera’s output either.

    For reference - the code in OpenCV’s cap_ffmpeg_impl.hpp around line 529 is as follows :

    522    bool CvCapture_FFMPEG::open( const char* _filename )
    523    {
    524        unsigned i;
    525        bool valid = false;
    526
    527        close();
    528
    529    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
    530        int err = avformat_open_input(&ic, _filename, NULL, NULL);
    531    #else
    532        int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
    533    #endif
    ...
    616    }

    ...for which I have no idea what I’m looking at.

    My entire program is rather large, so I’m editing it down as much as possible to help keep this readable - if I miss something you think is important please leave a comment telling me as much so I can throw it in...

    First up - this is one of the first things in main() so I don’t have to recompile every time I want to try a different value :

    3380    cout << "Please Enter Video Location: ";
    3381    cin >> videoFeedAddress;
    3382    cout << "videoFeedAddress: " << videoFeedAddress << endl;

    Just a simple string value.
    Next up - the actual place we’re having the problem ! Probably...

    Note that in the below code - if networkCam is false and a USB camera is connected there is no problem. The error here is caused by line 153.

    121    void displayCameraView()
    122    {
    123     if(camviewOn) // displayCameraView is triggered by a button the user can press as often as they want. Doesn't mean we want to let them break everything.
    124     {return;}
    125     else
    126     {
    127         CvCapture* cv_cap;
    128         VideoCapture cv_cap_IP;
    129         Mat color_img_IP;
    130         camviewOn = true;
    131         int capture;
    132         IplImage* color_img;
    133         if(!networkCam)
    134         {
    135             cv_cap = cvCaptureFromCAM(0);
    136             Sleep(100);
    137             if(!cv_cap)
    138             {
    139                 setExitError(1002);
    140                 if(textOutput){cout << "Video Error: Video input will not work.\n";}
    141                 MessageBox(hwnd, "Error opening camera.", "Error", MB_ICONEXCLAMATION);
    142                 cvReleaseCapture( &cv_cap );
    143                 cvDestroyWindow("Camera View");
    144                 return;
    145             }
    146             color_img = cvQueryFrame(cv_cap);
    147             clickPointStorage.create(((Mat)color_img).rows, ((Mat)color_img).cols, CV_8UC3);
    148         }
    149         else
    150         {
    151             ///*\
    152            
    153             cv_cap_IP.open(videoFeedAddress);
    154             Sleep(100);
    155             if(!cv_cap_IP.isOpened())
    156             {
    157                 setExitError(1002);
    158                 if(textOutput){cout << "Video Error: Video input will not work.\n";}
    159                 MessageBox(hwnd, "Error opening camera.", "Error", MB_ICONEXCLAMATION);
    160                 cvDestroyWindow("Camera View");
    161                 return;
    162             }
    163             clickPointStorage.create(color_img_IP.rows, color_img_IP.cols, CV_8UC3);
    164    
    165             //\*/
    166         }
    167         clickPointStorage.setTo(Scalar(0, 0, 0));
    168         cvNamedWindow("Camera View", 0); // create window
    169         cvSetMouseCallback("Camera View", CallBackFunc, NULL);
    170         IplImage* IplClickPointStorage = new IplImage(clickPointStorage);
    171         IplImage* Ipl_IP_Img;
    172        
    173         if(!networkCam)
    174         {
    175             for(;;)
    176             {
    177                 IplClickPointStorage = new IplImage(clickPointStorage);
    178                 cvAdd(cvQueryFrame(cv_cap), IplClickPointStorage, color_img); // get frame
    181                 cvShowImage("Camera View", color_img); // show frame
    182                 capture = cvWaitKey(10); // wait 10 ms or for key stroke
    183                 if(capture == 27 || capture == 13 || capture == 32){break;} // if ESC, Return, or space; close window.
    184             }
    185             /* clean up */
    186             cvReleaseCapture( &cv_cap );
    187             delete cv_cap;
    188             delete IplClickPointStorage;
    189         }
    190         else
    191         {
    192             ///*\
    193    
    194             for(;;)
    195             {
    196                 cv_cap_IP.read(color_img_IP);
    197                 IplClickPointStorage = new IplImage(clickPointStorage);
    198                 Ipl_IP_Img = new IplImage(color_img_IP);
    199                 cvAdd(Ipl_IP_Img, IplClickPointStorage, color_img);
    200                 cvShowImage("Camera View", color_img); // show frame
    201                 capture = cvWaitKey(10); // wait 10 ms or for key stroke
    202                 if(capture == 27 || capture == 13 || capture == 32){break;} // if ESC, Return, or space; close window.
    203             }
    204             cv_cap_IP.release();
    205             delete Ipl_IP_Img;
    206             delete IplClickPointStorage;
    207    
    208             //\*/
    209         }
    210         cvDestroyWindow("Camera View");
    211         camviewOn = false;
    212     }
    213     return;
    214    }

    As I said, on one computer I get the above error - both of them give me my own error from here :

    155             if(!cv_cap_IP.isOpened())
    156             {
    157                 setExitError(1002);
    158                 if(textOutput){cout << "Video Error: Video input will not work.\n";}
    159                 MessageBox(hwnd, "Error opening camera.", "Error", MB_ICONEXCLAMATION);
    160                 cvDestroyWindow("Camera View");
    161                 return;
    162             }

    ...which of course tells me cv_cap_IP is not open. One of my primary concerns is with the videoFeedAddress variable. No value I enter seems to get a different result.

    I searched the Googles - and come across a number of different "possible" answers - but none of them seem to work for me. If you attempt to google it yourself you may come across some of these :

    1. This is one of the first configurations my code was in. No dice.
    2. This one is talking about files - not cameras. It also mentions codecs - but I wouldn’t be able to watch it in a web browser if that were the problem, right ? (Correct me if I’m wrong here...)
    3. This one has the wrong error code/points to the wrong line of code !
    4. This one mentions compiling OpenCV with ffmpeg support - but I believe 2.4.6.0 already comes with that all set and ready ! Otherwise it’s not that different from what I’ve already tried.
    5. Now THIS one appears to be very similar to what I have, but the only proposed solution doesn’t really help as I had already located a list of connections. I do not believe this is a duplicate, because as per THIS meta discussion I had a lot more information and so didn’t feel comfortable taking over someone else’s question - especially if I end up needing to add even more information later.

    Back to the videoFeedAddress variable : I found THIS site that lists a number of possible addresses to connect to it. since there exists no 7100 anywhere in the list - and the install is the same for the DCS-7010L I used the addresses found next to the DCS-7010L listings. Most of them can be reached through the browser, confirming that they reach the camera - but they don’t seem to affect the outcome when I change them.

    As per many of the above links, I’ve tried many of them both with any without username:password, port number (554), and variations on ?.mjpg (the format) at the end.

    Any ideas ?