Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (38)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (5785)

  • writeImages and renaming the images using PHP

    3 mai 2015, par Kiran Kumar Dash

    I am working on a multimedia project. So, I am having a case where I am producing a sequence of images from a string input using he code below :

    <?php

       /*** a new Imagick object ***/
       $aniGif = new Imagick();

       /*** set the image format to gif ***/
       $aniGif->setFormat( "gif" );

       /*** a new ImagickPixel object for the colors ***/
       $color = new ImagickPixel( "white" );

       /*** set color to white ***/
       $color->setColor( "white" );

       $colorarray =array("white", "red", "blue" , "aqua", "fuchsia", "gray", "lime", "maroon", "navy", "orange", "purple", "silver", "teal", "yellow",  "green", "maroon", "green", "olive");

       /*** the text for the image ***/
       $string = "Hello Kiran Kumar";


       /*** a new draw object ***/
       $draw = new ImagickDraw();

       /*** set the draw font to helvetica ***/
       $draw->setFont( "./SociaLAnimaL.ttf" );

       /*** set the draw font to helvetica ***/
       $draw->setFontSize( "100" );

       /*** loop over the text ***/
       for ( $i = 0; $i <= strlen( $string ); $i++ )
       {
           /*** grab a character ***/
           $part = substr( $string, 0, $i );

           /*** a new ImagickPixel object for the colors ***/
           $color = new ImagickPixel( "white" );

           /*Generate random number for random color*/
           $randomNumber = rand(0,16);

           /*** create a new gif frame ***/
           $aniGif->newImage( 1920, 1200, $colorarray[$randomNumber] );

           /*** add the character to the image ***/
           $aniGif->annotateImage( $draw, 960, 600, 0, $part );

           /*** set the frame delay to 30 ***/
           $aniGif->setImageDelay( 30 );

       }
        /*** write the file ***/
           $aniGif->writeImages($directory.'kiran.jpg', $out);




       echo 'all done';

    ?>

    Now the problem is the writeimages object is generating images as kiran-0.jpg, kiran-1.jpg, kiran-2.jpg and so on. but what I am expecting is kiran001.jpg, kiran002.jpg, kiran003.jpg...and so on so that I can create a video out of it in while maintaining the sequence.Here is the code for video creation :

    <?php
    $ffmpeg= "/home/kiran/bin/ffmpeg";
       echo exec("$ffmpeg -f image2 -framerate 2/1 -pattern_type glob -i \"/var/www/html/fftest/getthumbnail/tmp/animate/est/*.jpg\" -i \"/var/www/html/fftest/getthumbnail/audios/audio1.mp3\" -c:v libx264 -c:a copy -shortest  -s 1920x1080 -r 60 -vf \"format=yuv420p\" \"/var/www/html/fftest/getthumbnail/output/animatedaudiocolor21.avi\" 2>&1" , $output, $return);
    ?>

    As you can see I am using -pattern type glob to select all the images, but this is getting confused with he naming sequence of kiran-0, kiran-1.

    So, what I am expecting here is how can I use writeimage object o name my images as the way mentioned above. so that I can use kiran%03d.jpg in my ffmpeg command instead of *.jpg.

    Or if any one can help me providing a code so that I can rename all the images in the expected manner.I tried the below code to rename all images :

    <?php
    $fileFolder="/fftest/getthumbnail/tmp/animate/test";
    $directory = $_SERVER['DOCUMENT_ROOT'].$fileFolder.'/';

    $i = 001;
    $handler = opendir($directory);
    while ($file = readdir($handler)) {
       if ($file != "." && $file != "..") {
           $newName = 'kiran'.$i ;
           rename($directory.$file, $directory.$newName); // here; prepended a $directory
           $i++;
       }
    }
    closedir($handler);

    ?>

    But the code is unable to rename the images in sequence.

    Help please...

  • Bash Shell Script Remote Background Processing

    22 mai 2015, par user281738

    I Have Created a Bash Shell script.. With that i can crop and convert video locally..

    nohup ffmpeg -i "$c1" -vf "$crop_value1" -b 1800k "/home/Cropped/""$name1"_cropped.mp4"" > crop1.txt &
    PID1=$!
    nohup ffmpeg -i "$c2" -vf "$crop_value2" -b 1800k "/home/Cropped/""$name2"_cropped.mp4"" > crop2.txt &
    PID2=$!
    nohup ffmpeg -i "$c3" -vf "$crop_value3" -b 1800k "/home/Cropped/""$name3"_cropped.mp4"" > crop3.txt &
    PID3=$!
    nohup ffmpeg -i "$c4" -vf "$crop_value4" -b 1800k "/home/Cropped/""$name4"_cropped.mp4"" > crop4.txt &
    PID4=$!
    wait $PID1
    wait $PID2
    wait $PID3
    wait $PID4

    As Above Code Shows Im Using 4 Conversion In background In Local Server And I’m Using Wait PID To Check Whether Conversation Finished Or Not.

    My Problem Is Its taking very late to Convert.. So I Thinking Of Converting One Conversion In Local Sever And Another Three In Different Remote Server Through SSH
    Example :

    ssh user@192.168.1.1 "nohup ffmpeg -i "$c1" -vf "$crop_value1" -b 1800k "/home/Cropped/""$name1"_cropped.mp4"" > crop1.txt &"

    My Problem Is After Executing Remote Commands How Can I Get Remote PID And Use PID Wait Option For All Remote Connection.

  • FFmpeg h264_v4l2m2m to rtmp

    6 juillet 2021, par KnightRex

    On an up to date Raspberry Pi 4 B+ 4GB with the Raspberry OS 32bit I'm attempting to stream to an rtmp service, like Youtube or Twitch with FFmpeg using the hardware encoder h264_v4l2m2m but it fails.

    


    Issue

    


    When streaming the streaming service it ingests the input, bitrate and goes live but no output is shown. When connecting to Twitch the stream inspector correctly detects video resolution but fails to detect the codec or fps.

    


    When I replace the stream output to for example a file, test.flv, it records a viewable video with the correct codec (h264/aac) codecs in vlc and ffplay.

    


    When I replace the h264_v4l2m2m encoder with h264_omx it streams the video correctly.

    


    Steps

    


      

    • Installed a clean version of the latest Raspi OS 32bit

      


    • 


    • Recompiled FFmpeg to 4.3.2 (to the solve green screen)

      


    • 


    • Record video, creates viewable video :

      


      ffmpeg \
-f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 \
-c:v h264_v4l2m2m -g 60 -pix_fmt yuv420p -b:v 3000k -minrate 3000k -maxrate 3000k -r 30 -an \
-t 15 test.flv


      


    • 


    • Start stream, unable to view :

      


      ffmpeg \&#xA;-f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 \&#xA;-c:v h264_v4l2m2m -g 60 -pix_fmt yuv420p -b:v 3000k -minrate 3000k -maxrate 3000k -r 30 -an \&#xA;-f flv "<destination uri="uri">"&#xA;</destination>

      &#xA;

    • &#xA;

    • Start stream, unable to view (Extended based on comments below) :

      &#xA;

      ffmpeg \&#xA; -re -f lavfi -i anullsrc \&#xA; -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 \&#xA; -c:v h264_v4l2m2m -g 60 -pix_fmt yuv420p -b:v 3000k -minrate 3000k -maxrate 3000k -r 30 \&#xA; -c:a aac \&#xA; -f flv "<destination uri="uri">"&#xA;</destination>

      &#xA;

    • &#xA;

    • Start stream, with omx works :

      &#xA;

      ffmpeg \&#xA;-f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 \&#xA;-c:v h264_omx -preset ultrafast -pix_fmt yuv420p -g 60 -b:v 3000k -minrate 3000k -maxrate 3000k -r 30 -an \&#xA;-f flv "<destination uri="uri">"&#xA;</destination>

      &#xA;

    • &#xA;

    &#xA;

    Output

    &#xA;

    With h264_v4l2m2m (invalid output - loglevel verbose) :

    &#xA;

    $ ffmpeg -re -f lavfi -i anullsrc  -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0  -c:v h264_v4l2m2m -g 60 -pix_fmt yuv420p -b:v 3000k -minrate 3000k -maxrate 3000k -r 30 -c:a aac -f flv <destination url="url">&#xA;ffmpeg version n4.3.2 Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with gcc 8 (Raspbian 8.3.0-6&#x2B;rpi1)&#xA;  configuration: --prefix=/home/pi/ffmpeg_build --bindir=/home/pi/bin --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=&#x27;-lpthread -lm -latomic&#x27; --enable-omx --enable-encoder=h264_omx&#xA;  libavutil      56. 51.100 / 56. 51.100&#xA;  libavcodec     58. 91.100 / 58. 91.100&#xA;  libavformat    58. 45.100 / 58. 45.100&#xA;  libavdevice    58. 10.100 / 58. 10.100&#xA;  libavfilter     7. 85.100 /  7. 85.100&#xA;  libswscale      5.  7.100 /  5.  7.100&#xA;  libswresample   3.  7.100 /  3.  7.100&#xA;[Parsed_anullsrc_0 @ 0x7215c0] sample_rate:44100 channel_layout:&#x27;stereo&#x27; nb_samples:1024&#xA;Input #0, lavfi, from &#x27;anullsrc&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 705 kb/s&#xA;    Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s&#xA;[video4linux2,v4l2 @ 0x725350] fd:3 capabilities:84a00001&#xA;[mjpeg @ 0x1e10210] EOI missing, emulating&#xA;Input #1, video4linux2,v4l2, from &#x27;/dev/video0&#x27;:&#xA;  Duration: N/A, start: 42396.344658, bitrate: N/A&#xA;    Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 1000k tbn, 1000k tbc&#xA;[tcp @ 0x72cac0] Starting connection attempt to <destination ip="ip"> port 1935&#xA;[tcp @ 0x72cac0] Successfully connected to <destination ip="ip"> port 1935&#xA;Stream mapping:&#xA;  Stream #1:0 -> #0:0 (mjpeg (native) -> h264 (h264_v4l2m2m))&#xA;  Stream #0:0 -> #0:1 (pcm_u8 (native) -> aac (native))&#xA;Press [q] to stop, [?] for help&#xA;[graph 0 input from stream 1:0 @ 0x73de00] w:1280 h:720 pixfmt:yuvj422p tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2&#xA;[auto_scaler_0 @ 0x745400] w:iw h:ih flags:&#x27;bicubic&#x27; interl:0&#xA;[format @ 0x73e750] auto-inserting filter &#x27;auto_scaler_0&#x27; between the filter &#x27;Parsed_null_0&#x27; and the filter &#x27;format&#x27;&#xA;[swscaler @ 0x1e300b0] deprecated pixel format used, make sure you did set range correctly&#xA;[auto_scaler_0 @ 0x745400] w:1280 h:720 fmt:yuvj422p sar:0/1 -> w:1280 h:720 fmt:yuv420p sar:0/1 flags:0x4&#xA;[h264_v4l2m2m @ 0x72a500] driver &#x27;bcm2835-codec&#x27; on card &#x27;bcm2835-codec-isp&#x27;&#xA;[h264_v4l2m2m @ 0x72a500] driver &#x27;uvcvideo&#x27; on card &#x27;USB Video: USB Video&#x27;&#xA;    Last message repeated 1 times&#xA;[h264_v4l2m2m @ 0x72a500] driver &#x27;bcm2835-codec&#x27; on card &#x27;bcm2835-codec-encode&#x27;&#xA;[h264_v4l2m2m @ 0x72a500] Using device /dev/video11&#xA;[h264_v4l2m2m @ 0x72a500] driver &#x27;bcm2835-codec&#x27; on card &#x27;bcm2835-codec-encode&#x27;&#xA;[h264_v4l2m2m @ 0x72a500] Failed to set number of B-frames&#xA;    Last message repeated 1 times&#xA;[h264_v4l2m2m @ 0x72a500] Failed to set gop size&#xA;[h264_v4l2m2m @ 0x72a500] h264 profile not found&#xA;[h264_v4l2m2m @ 0x72a500] Encoder adjusted: qmin (0), qmax (51)&#xA;[h264_v4l2m2m @ 0x72a500] Failed to set minimum video quantizer scale&#xA;[h264_v4l2m2m @ 0x72a500] Failed to set maximum video quantizer scale&#xA;[graph_1_in_0_0 @ 0x786f90] tb:1/44100 samplefmt:u8 samplerate:44100 chlayout:0x3&#xA;[format_out_0_1 @ 0x7871d0] auto-inserting filter &#x27;auto_resampler_0&#x27; between the filter &#x27;Parsed_anull_0&#x27; and the filter &#x27;format_out_0_1&#x27;&#xA;[auto_resampler_0 @ 0x7887f0] ch:2 chl:stereo fmt:u8 r:44100Hz -> ch:2 chl:stereo fmt:fltp r:44100Hz&#xA;Output #0, flv, to &#x27;<destination url="url">&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.45.100&#xA;    Stream #0:0: Video: h264 (h264_v4l2m2m) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1280x720, q=-1--1, 3000 kb/s, 30 fps, 1k tbn, 30 tbc&#xA;    Metadata:&#xA;      encoder         : Lavc58.91.100 h264_v4l2m2m&#xA;    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.91.100 aac&#xA;[video4linux2,v4l2 @ 0x1e0f410] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)&#xA;frame= 1966 fps= 24 q=-0.0 size=   13016kB time=00:01:23.60 bitrate=1275.4kbits/s speed=   1x&#xA;</destination></destination></destination></destination>

    &#xA;

      &#xA;
    • deprecated pixel format yuvy422p : video0 has mjpeg and raw output in pixel format yuvy422p.
    • &#xA;

    &#xA;

    With h264 omx (works)

    &#xA;

      libavutil      56. 22.100 / 56. 22.100&#xA;  libavcodec     58. 35.100 / 58. 35.100&#xA;  libavformat    58. 20.100 / 58. 20.100&#xA;  libavdevice    58.  5.100 / 58.  5.100&#xA;  libavfilter     7. 40.101 /  7. 40.101&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  3.100 /  5.  3.100&#xA;  libswresample   3.  3.100 /  3.  3.100&#xA;  libpostproc    55.  3.100 / 55.  3.100&#xA;Input #0, lavfi, from &#x27;anullsrc&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 705 kb/s&#xA;    Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s&#xA;[mjpeg @ 0x7c7320] EOI missing, emulating&#xA;Input #0, video4linux2,v4l2, from &#x27;/dev/video0&#x27;:&#xA;  Duration: N/A, start: 71.378330, bitrate: N/A&#xA;    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 1000k tbn, 1000k tbc&#xA;Codec AVOption preset (Configuration preset) specified for output file #0 (<destination url="url">) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (h264_omx))&#xA;  Stream #0:0 -> #0:1 (pcm_u8 (native) -> aac (native))&#xA;Press [q] to stop, [?] for help&#xA;[swscaler @ 0x7e5180] deprecated pixel format used, make sure you did set range correctly&#xA;[h264_omx @ 0x7cb800] Using OMX.broadcom.video_encode&#xA;Output #0, flv, to &#x27;<destination url="url">&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.20.100&#xA;    Stream #0:0: Video: h264 (h264_omx) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1280x720, q=2-31, 3000 kb/s, 30 fps, 1k tbn, 30 tbc&#xA;    Metadata:&#xA;      encoder         : Lavc58.35.100 h264_omx&#xA;    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.35.100 aac&#xA;[flv @ 0x7ca190] Failed to update header with correct duration.rate=1438.3kbits/s speed=   1x&#xA;[flv @ 0x7ca190] Failed to update header with correct filesize.&#xA;frame= 2190 fps= 24 q=-0.0 Lsize=   16424kB time=00:01:33.20 bitrate=1443.6kbits/s speed=   1x&#xA;</destination></destination>

    &#xA;