Recherche avancée

Médias (91)

Autres articles (30)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (4856)

  • Ffmpeg video output is 0 seconds with correct filesize when uploading to google cloud bucket

    22 août 2022, par Turgut

    I've made a C++ program that lives in gke and takes some videos as input using ffmpeg, then does something with that input using opengl(not relevant), then finally encodes those edited videos as a single output. Normally the program works perfectly fine on my local machine, it encodes just as I want it to with no warnings or valgrind errors whatsoever. Then, after encoding the said video, I want my program to upload that video to the google cloud storage. This is where the problem comes, I have tried 2 methods for this : First, I tried using curl to upload to the cloud using a signed url. Second, I tried mounting the google storage using gcsfuse(I was already mounting the bucket to access the inputs in question). Both of those methods yielded undefined, weird behaviour's ranging from : Outputing a 0byte or 44byte file, (This is the most common one :) encoding in the correct file size 500mb but the video is 0 seconds long, outputing a 0.4 second video or just encoding the desired output normally (really rare).

    


    From the logs I can't see anything unusual, everything seems to work fine and ffmpeg does not give any errors or warnings, so does valgrind. Everything seems to work normally, even when I use curl to upload the video to the cloud the output is perfectly fine when it first encodes it (before sending it with curl) but the video gets messed up when curl uploads it to the cloud.

    


    I'm using the muxing.c example of ffmpeg to encode my video with the only difference being :

    


    void video_encoder::fill_yuv_image(AVFrame *frame, struct SwsContext *sws_context) {
    const int in_linesize[1] = { 4 * width };
    //uint8_t* dest[4] = { rgb_data, NULL, NULL, NULL };
    sws_context = sws_getContext(
            width, height, AV_PIX_FMT_RGBA,
            width, height, AV_PIX_FMT_YUV420P,
            SWS_BICUBIC, 0, 0, 0);

    sws_scale(sws_context, (const uint8_t * const *)&rgb_data, in_linesize, 0,
            height, frame->data, frame->linesize);
}


    


    rgb_data is the data I got after editing the inputs. Again, this works fine and I don't think there are any errors here.

    


    I'm not sure where the error is and since the code is huge I can't provide a replicable example. I'm just looking for someone to point me to the right direction.

    


    Running the cloud's output in mplayer wields this result (This is when the video is the right size but is 0 seconds long, the most common one.) :

    


    MPlayer 1.4 (Debian), built with gcc-11 (C) 2000-2019 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing /media/c36c2633-d4ee-4d37-825f-88ae54b86100.
libavformat version 58.76.100 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f2cba1168e0]moov atom not found
LAVF_header: av_open_input_stream() failed
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f2cba1168e0]moov atom not found
LAVF_header: av_open_input_stream() failed
RAWDV file format detected.
VIDEO:  [DVSD]  720x480  24bpp  29.970 fps    0.0 kbps ( 0.0 kbyte/s)
X11 error: BadMatch (invalid parameter attributes)
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.134.100 (external)
[dvvideo @ 0x7f2cb987a380]Requested frame threading with a custom get_buffer2() implementation which is not marked as thread safe. This is not supported anymore, make your callback thread-safe.
Selected video codec: [ffdv] vfm: ffmpeg (FFmpeg DV)
==========================================================================
Load subtitles in /media/
==========================================================================
Opening audio decoder: [libdv] Raw DV Audio Decoder
Unknown/missing audio format -> no sound
ADecoder init failed :(
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[dvaudio @ 0x7f2cb987a380]Decoder requires channel count but channels not set
Could not open codec.
ADecoder init failed :(
ADecoder init failed :(
Cannot find codec for audio format 0x56444152.
Audio: no sound
Starting playback...
[dvvideo @ 0x7f2cb987a380]could not find dv frame profile
Error while decoding frame!
[dvvideo @ 0x7f2cb987a380]could not find dv frame profile
Error while decoding frame!
V:   0.0   2/  2 ??% ??% ??,?% 0 0 


Exiting... (End of file)




    


    Edit : Since the code runs on a VM, I'm using xvfb-run ro start my application, but again even when using xvfb-run it works completely fine on when not encoding to the cloud.

    


  • Dreamcast Operating Systems

    16 septembre 2010, par Multimedia Mike — Sega Dreamcast

    The Sega Dreamcast was famously emblazoned with a logo proudly announcing that it was compatible with Windows CE :



    It’s quite confusing. The console certainly doesn’t boot into some version of Windows to launch games. Apparently, there was a special version of CE developed for the DC and game companies had the option to leverage it. I do recall that some game startup screens would similarly advertise Windows CE.

    Once the homebrew community got ahold of the device, the sky was the limit. I think NetBSD was the first alternative OS to support the Dreamcast. Meanwhile, I have recollections of DC Linux and LinuxDC projects along with more generic Linux-SH and SH-Linux projects.



    DC Evolution hosts a disc image available for download with an unofficial version of DC Linux, assembled by one Adrian O’Grady. I figured out how to burn the disc (burning DC discs is a blog post of its own) and got it working in the console.

    It’s possible to log in directly via the physical keyboard or through a serial terminal provided that you have a coder’s cable. That reminds me– my local Fry’s had a selection of USB-to-serial cables. I think this is another area that is sufficiently commoditized that just about any cable ought to work with Linux out of the box. Or maybe I’m just extrapolating from the experience of having the cheapest cable in the selection (made by io connect) plug and play with Linux.



    Look ! No messy converter box in the middle as in the Belkin case. The reason I went with this cable is that the packaging claimed it was capable of up to 500 Kbits/sec. Most of the cables advertised a max of 115200 bps. I distinctly recall being able to use the DC coder’s cable at 230400 bps a long time ago. Alas, 115200 seems to be the speed limit, even with this new USB cable.

    Anyway, the distribution is based on a 2.4.5 kernel circa 2001. I tried to make PPP work over the serial cable but the kernel doesn’t have support. If you’re interested, here is some basic information about the machine from Linux’s perspective, gleaned from some simple commands. This helps remind us of a simpler time when Linux was able to run comfortably on a computer with 16 MB of RAM.

    Debian GNU/Linux testing/unstable dreamcast ttsc/1
    

    dreamcast login : root
    Linux dreamcast 2.4.5 #27 Thu May 31 07:06:51 JST 2001 sh4 unknown

    Most of the programs included with the Debian GNU/Linux system are
    freely redistributable ; the exact distribution terms for each program
    are described in the individual files in /usr/share/doc/*/copyright

    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.

    dreamcast : # uname -a
    Linux dreamcast 2.4.5 #27 Thu May 31 07:06:51 JST 2001 sh4 unknown

    dreamcast : # cat /proc/cpuinfo
    cpu family : SH-4
    cache size : 8K-byte/16K-byte
    bogomips : 199.47

    Machine : dreamcast
    CPU clock : 200.00MHz
    Bus clock : 100.00MHz
    Peripheral module clock : 50.00MHz

    dreamcast : # top -b

    09:14:54 up 14 min, 1 user, load average : 0.04, 0.03, 0.03
    15 processes : 14 sleeping, 1 running, 0 zombie, 0 stopped
    CPU states : 1.1% user, 5.8% system, 0.0% nice, 93.1% idle
    Mem : 14616K total, 11316K used, 3300K free, 2296K buffers
    Swap : 0K total, 0K used, 0K free, 5556K cached

    PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
    219 root 18 0 1072 1068 868 R 5.6 7.3 0:00 top
    1 root 9 0 596 596 512 S 0.0 4.0 0:01 init
    2 root 9 0 0 0 0 SW 0.0 0.0 0:00 keventd
    3 root 9 0 0 0 0 SW 0.0 0.0 0:00 kswapd
    4 root 9 0 0 0 0 SW 0.0 0.0 0:00 kreclaimd
    5 root 9 0 0 0 0 SW 0.0 0.0 0:00 bdflush
    6 root 9 0 0 0 0 SW 0.0 0.0 0:00 kupdated
    7 root 9 0 0 0 0 SW 0.0 0.0 0:00 kmapled
    39 root 9 0 900 900 668 S 0.0 6.1 0:00 devfsd
    91 root 8 0 652 652 556 S 0.0 4.4 0:00 pump
    96 daemon 9 0 524 524 420 S 0.0 3.5 0:00 portmap
    149 root 9 0 944 944 796 S 0.0 6.4 0:00 syslogd
    152 root 9 0 604 604 456 S 0.0 4.1 0:00 klogd
    187 root 9 0 540 540 456 S 0.0 3.6 0:00 getty
    201 root 9 0 1380 1376 1112 S 0.0 9.4 0:01 bash

    Note that at this point I had shutdown both gpm and inetd. The rest of the processes, save for bash, are default. The above stats only report about 14 MB of RAM ; where are the other 2 MB ?

    dreamcast : # df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/rd/1             2.0M  560k  1.4M  28% /
    
  • Creating a reflection

    9 juin 2010, par Mikko Koppanen — Imagick, PHP stuff

    Here is a simple example of creating a reflection of an image. The reflection is created by flipping the image and overlaying a gradient on it. Then both, the original image and the reflection is overlayed on a canvas.

    This example is created for Imagick 2.1.x but with a little tuning it should work with earlier versions.

    1. < ?php
    2.  
    3. /* Read the image */
    4. $im = new Imagick( "strawberry.png" ) ;
    5.  
    6. /* Thumbnail the image */
    7. $im->thumbnailImage( 200, null ) ;
    8.  
    9. /* Create a border for the image */
    10. $im->borderImage( "white", 5, 5 ) ;
    11.  
    12. /* Clone the image and flip it */
    13. $reflection = $im->clone() ;
    14. $reflection->flipImage() ;
    15.  
    16. /* Create gradient. It will be overlayd on the reflection */
    17. $gradient = new Imagick() ;
    18.  
    19. /* Gradient needs to be large enough for the image
    20. and the borders */
    21. $gradient->newPseudoImage( $reflection->getImageWidth() + 10,
    22.               $reflection->getImageHeight() + 10,
    23.               "gradient:transparent-black"
    24.             ) ;
    25.  
    26. /* Composite the gradient on the reflection */
    27. $reflection->compositeImage( $gradient, imagick: :COMPOSITE_OVER, 0, 0 ) ;
    28.  
    29. /* Add some opacity */
    30. $reflection->setImageOpacity( 0.3 ) ;
    31.  
    32. /* Create empty canvas */
    33. $canvas = new Imagick() ;
    34.  
    35. /* Canvas needs to be large enough to hold the both images */
    36. $width = $im->getImageWidth() + 40 ;
    37. $height = ( $im->getImageHeight() * 2 ) + 30 ;
    38. $canvas->newImage( $width, $height, "black", "png" ) ;
    39.  
    40. /* Composite the original image and the reflection on the canvas */
    41. $canvas->compositeImage( $im, imagick: :COMPOSITE_OVER, 20, 10 ) ;
    42. $canvas->compositeImage( $reflection, imagick: :COMPOSITE_OVER,
    43.             20, $im->getImageHeight() + 10 ) ;
    44.  
    45. /* Output the image*/
    46. header( "Content-Type : image/png" ) ;
    47. echo $canvas ;
    48.  
    49.  ?>

    The source image :

    source

    And the result :

    result

    P.S. Please send me some new images which I can use in these examples ;)