Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (76)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (3774)

  • Android video crop using ffmpeg

    12 août 2016, par Pramod Patel

    I am using https://github.com/WritingMinds/ffmpeg-android-java for cropping a video using this command :

    execFFmpegCommand(" -i " + in + " -filter:v " + "crop=" + 240 + ":" + 120 + ":" + 100 + ":" + 100 + " -c:a copy " + out);

    where "in" is inputfile and "out" is outputfile.

    I went through a lot of same questions and couldn’t find required solution for this. I also tried the following command which i found going through the search :

    execFFmpegCommand(" -i " + in + " -filter:v " + "crop=" + 240 + ":" + 120 + ":" + 100 + ":" + 100 + " -c:a copy " + out);

    The main error that I’m getting here is : Output file #0 does not contain any stream

    private void execFFmpegCommand(final String command) {
       try {
           ffmpeg.execute(new String[]{command}, new ExecuteBinaryResponseHandler() {
               @Override
               public void onFailure(String s) {
                   Log.d(TAG, "FAILED with output : " + s);
                   progressDialog.dismiss();

               }

               @Override
               public void onSuccess(String s) {
                   Log.d(TAG, "SUCCESS with output : " + s);
               }

               @Override
               public void onProgress(String s) {
                   Log.d(TAG, "Started command : ffmpeg " + command);
                   Log.d(TAG, "progress : " + s);
               }

               @Override
               public void onStart() {
                   Log.d(TAG, "Started command : ffmpeg " + command);
                   progressDialog.show();
               }

               @Override
               public void onFinish() {
                   Log.d(TAG, "Finished command : ffmpeg " + command);
                   progressDialog.dismiss();

               }
           });
       } catch (FFmpegCommandAlreadyRunningException e) {
           // do nothing for now
       }
    }

    The LogCat is :

    D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.209 17283-17866/com.myapp D/FFmpeg: Running publishing updates method
    08-12 11:16:03.231 17283-17283/com.myapp W/MediaRecorder: mediarecorder went away with unhandled events
    08-12 11:16:03.232 17283-17283/com.myapp W/MediaRecorder: mediarecorder went away with unhandled events
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: progress : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: progress :   built with gcc 4.8 (GCC)
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: progress :   configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libavutil      55. 17.103 / 55. 17.103
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libavcodec     57. 24.102 / 57. 24.102
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libavformat    57. 25.100 / 57. 25.100
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libavdevice    57.  0.101 / 57.  0.101
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libavfilter     6. 31.100 /  6. 31.100
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libswscale      4.  0.100 /  4.  0.100
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libswresample   2.  0.101 /  2.  0.101
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress :   libpostproc    54.  0.100 / 54.  0.100
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : Output #0, mp4, to ' -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4':
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
    08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : Output file #0 does not contain any stream
    08-12 11:16:03.357 17283-17283/com.myapp D/ffmpeg: FAILED with output : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
                                                               built with gcc 4.8 (GCC)
                                                               configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
                                                               libavutil      55. 17.103 / 55. 17.103
                                                               libavcodec     57. 24.102 / 57. 24.102
                                                               libavformat    57. 25.100 / 57. 25.100
                                                               libavdevice    57.  0.101 / 57.  0.101
                                                               libavfilter     6. 31.100 /  6. 31.100
                                                               libswscale      4.  0.100 /  4.  0.100
                                                               libswresample   2.  0.101 /  2.  0.101
                                                               libpostproc    54.  0.100 / 54.  0.100
                                                             Output #0, mp4, to ' -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4':
                                                             Output file #0 does not contain any stream
    08-12 11:16:03.370 17283-17283/com.myapp D/ffmpeg: Finished command : ffmpeg  -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
  • live video streaming not playing on dash.js player using ffmpeg, nginx-rtmp in raspberry pi

    15 août 2016, par sparks

    I am trying to stream a live video from raspberry pi & pi camera module to web browser.But the video doesn’t play.I am using Nginx-rtmp and ffmpeg to process the video. On the client side i use dash js player trying to play the video but no luck.I see the warning on the terminal

    [flv @ 0x2c3b950] Failed to update header with correct duration.
    [flv @ 0x2c3b950] Failed to update header with correct filesize.

    But i am not sure if this could be the issue. Anybody knows what might be wrong ?I don’t expect a straight answer but i am sure somebody can guide me in the right direction. Thank you in advance. Here is my set up

    Nginx.conf

    events {
     worker_connections  1024;
    }


    http     {
           include       mime.types;
           default_type  application/octet-stream;


    sendfile        on;

    keepalive_timeout  65;

    server {
       listen       80;
       server_name 192.168.1.114 localhost;
       location / {
           root   /var/www;
           index  index.html index.htm;
       }


       location /dash {
           root /var/www;
           add_header Cache-Control no-cache;
       }

        location /dash.js{
           root /var/www;
         }

        location /hls {
          types {
           application/vnd.apple.mpegurl m3u8;
           video/mp2t ts;
         }

         root /var/www;
         index index.html;
         add_header Cache-Control no-cache;
       }

       location /rtmpcontrol{
           rtmp_control all;
        }

       location /rtmpstat{
           rtmp_stat all;
        }

       #error_page  404              /404.html;


              error_page   500 502 503 504  /50x.html;
       location = /50x.html {
           root   html;
       }

          }
    rtmp {
      server {
       listen 1935;

       chunk_size 4000;

       application rtmp {
           live on;
           hls on;
           dash on;
           dash_path /var/www/dash;
           hls_path /var/www/hls;
       }
     }
    }

    baseline.html

       
       
       
       

       
       

       
       

       
       <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/dash.all.js'&gt;&lt;/script&gt;
    &lt;script&gt;<br />
           function getUrlVars() {<br />
               var vars = {};<br />
               var parts = window.location.href.replace(/[?&amp;amp;]+([^=&amp;amp;]+)=([^&amp;amp;]*)/gi, function(m,key,value) {<br />
                   vars[key] = value;<br />
               });<br />
               return vars;<br />
           }<br />
    <br />
           function startVideo() {<br />
               var vars = getUrlVars(),<br />
                   url = &quot;http://192.168.1.114:80/dash/stream.mpd&quot;,<br />
                   video,<br />
                   context,<br />
                   player;<br />
    <br />
               if (vars &amp;amp;&amp;amp; vars.hasOwnProperty(&quot;url&quot;)) {<br />
                   url = vars.url;<br />
               }<br />
    <br />
               video = document.querySelector(&quot;.dash-video-player video&quot;);<br />
               context = new Dash.di.DashContext();<br />
               player = new MediaPlayer(context);<br />
    <br />
               player.startup();<br />
    <br />
               player.attachView(video);<br />
               player.setAutoPlay(false);<br />
    <br />
               player.attachSource(url);<br />
           }<br />
       &lt;/script&gt;

    &lt;body onload=&quot;startVideo()&quot;&gt;

    How i grab and push video stream

    raspivid -w 640 -h 480 -fps 25 -t 0 -b 1800000 -o - | ffmpeg -y -f h264 -i - -vcodec libx264  -f flv -rtmp_buffer 100 -rtmp_live live rtmp://localhost:1935/rtmp/stream

    When i run the above command, i see the following on the terminal

       ffmpeg version N-81256-gd3426fb Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.9.2 (Raspbian 4.9.2-10)
     configuration: --enable-gpl --enable-libx264 --enable-nonfree
     libavutil      55. 28.100 / 55. 28.100
     libavcodec     57. 51.100 / 57. 51.100
     libavformat    57. 44.100 / 57. 44.100
     libavdevice    57.  0.102 / 57.  0.102
     libavfilter     6. 49.100 /  6. 49.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  1.100 /  2.  1.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, h264, from 'pipe:':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuv420p, 640x480, 25 fps, 25 tbr, 1200k tbn, 50 tbc
    [tcp @ 0x2c3c850] Connection to tcp://localhost:1935 failed (Connection refused), trying next address
    [libx264 @ 0x2c50d80] using cpu capabilities: ARMv6 NEON
    [libx264 @ 0x2c50d80] profile High, level 3.0
    [libx264 @ 0x2c50d80] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [flv @ 0x2c3b950] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Output #0, flv, to 'rtmp://localhost:1935/rtmp/stream':
     Metadata:
       encoder         : Lavf57.44.100
       Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 640x480, q=-1--1, 25 fps, 1k tbn, 25 tbc
       Metadata:
         encoder         : Lavc57.51.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    ^Cmmal: Aborting program.0 size=     930kB time=00:00:45.44 bitrate= 167.7kbits/s speed=1.03x    

    [flv @ 0x2c3b950] Failed to update header with correct duration.
    [flv @ 0x2c3b950] Failed to update header with correct filesize.
    frame= 1197 fps= 26 q=-1.0 Lsize=     976kB time=00:00:47.76 bitrate= 167.5kbits/s speed=1.04x    
    video:953kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.484349%
    [libx264 @ 0x2c50d80] frame I:5     Avg QP:18.91  size:  3600
    [libx264 @ 0x2c50d80] frame P:299   Avg QP:21.38  size:  1486
    [libx264 @ 0x2c50d80] frame B:893   Avg QP:20.62  size:   574
    [libx264 @ 0x2c50d80] consecutive B-frames:  0.4%  0.0%  1.0% 98.6%
    [libx264 @ 0x2c50d80] mb I  I16..4: 10.1% 87.1%  2.8%
    [libx264 @ 0x2c50d80] mb P  I16..4:  3.8%  7.4%  0.0%  P16..4: 34.2%  2.1%  1.5%  0.0%  0.0%    skip:51.0%
    [libx264 @ 0x2c50d80] mb B  I16..4:  0.2%  0.3%  0.0%  B16..8: 20.1%  0.4%  0.0%  direct: 3.8%  skip:75.1%  L0:48.6% L1:50.9% BI: 0.6%
    [libx264 @ 0x2c50d80] 8x8 transform intra:68.1% inter:97.0%
    [libx264 @ 0x2c50d80] coded y,uvDC,uvAC intra: 10.1% 27.5% 1.8% inter: 2.0% 12.9% 0.1%
    [libx264 @ 0x2c50d80] i16 v,h,dc,p: 18% 20%  9% 53%
    [libx264 @ 0x2c50d80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 11% 58%  2%  2%  1%  2%  1%  1%
    [libx264 @ 0x2c50d80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 26% 30%  3%  4%  4%  6%  2%  2%
    [libx264 @ 0x2c50d80] i8c dc,h,v,p: 66% 18% 15%  1%
    [libx264 @ 0x2c50d80] Weighted P-Frames: Y:1.7% UV:1.3%
    [libx264 @ 0x2c50d80] ref P L0: 58.2%  2.2% 25.5% 14.1%  0.1%
    [libx264 @ 0x2c50d80] ref B L0: 81.7% 13.3%  5.0%
    [libx264 @ 0x2c50d80] ref B L1: 93.6%  6.4%
    [libx264 @ 0x2c50d80] kb/s:162.87
    Exiting normally, received signal 2.

    On my var/www/dash directory

    stream-0.m4a  stream-19200.m4a  stream-29200.m4a  
    stream-9600.m4a    stream-init.m4a  stream.mpd      stream-raw.m4v
    stream-0.m4v  stream-19200.m4v  stream-29200.m4v  stream-9600.m4v    stream-init.m4v  stream-raw.m4a
  • AFTER PHP-FFMpeg not converting (error with ffmpeg)

    15 août 2016, par Magurean Dan Sergiu

    I have installed ffmpeg server side with all the dependencies, updated it. And then installed PHP-FFMpeg with Composer. Tested that ffmpeg is instaled with a ssh conexion.

    root@host [/opt/ffmpeg]# ffmpeg
    ffmpeg version N-81322-ge8b355a Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
    configuration: --disable-yasm
    libavutil      55. 28.100 / 55. 28.100
    libavcodec     57. 51.100 / 57. 51.100
    libavformat    57. 46.100 / 57. 46.100
    libavdevice    57.  0.102 / 57.  0.102
    libavfilter     6. 51.100 /  6. 51.100
    libswscale      4.  1.100 /  4.  1.100
    libswresample   2.  1.100 /  2.  1.100
    Hyper fast Audio and Video encoder
    usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]     outfile}...

    Use -h to get full help or, even better, run 'man ffmpeg'

    But when I try to convert a video file with a php script it throws me a very long error.
    PHP Code :

    &lt;?PHP
    include($_SERVER['DOCUMENT_ROOT']."/vendors/install/vendor/autoload.php");
    $ffmpeg = FFMpeg\FFMpeg::create();
    $video = $ffmpeg->open($_SERVER['DOCUMENT_ROOT'].'/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.wmv');
    $video
          ->filters()
          ->synchronize();
    $format = new FFMpeg\Format\Video\X264();
    $format->on('progress', function ($video, $format, $percentage) {
       echo "$percentage % transcoded";});
    $video
         ->save($format,$_SERVER['DOCUMENT_ROOT'].'/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.mp4');
    ?>

    Error displayed :

    <b>Fatal error</b>:  Uncaught exception 'Alchemy\BinaryDriver\Exception\ExecutionFailureException' with message 'ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-y' '-i' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.wmv' '-async' '1' '-metadata:s:v:0' 'start_time=0' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes57ad320a1b685j794u/pass-57ad320a1b716' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.mp4'' in /home/user/working/vendors/install/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:100↵Stack trace:↵#0 /home/user/working/vendors/install/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php(72): Alchemy\BinaryDriver\ProcessRunner-&amp;gt;doExecutionFailure(''/usr/bin/ffmpe...')↵#1 / in <b>/home/user/working/vendors/install/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php</b> on line <b>168</b><br />↵"

    Then I have took the basic code displayed upwards and ran it directly through ssh.

    '/usr/local/bin/ffmpeg' '-y' '-i' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.wmv' '-async' '1' '-metadata:s:v:0' 'start_time=0' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes57ad320a1b685j794u/pass-57ad320a1b716' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.mp4'

    And this is the response I get :

    ffmpeg version N-81322-ge8b355a Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
     configuration: --disable-yasm
     libavutil      55. 28.100 / 55. 28.100
     libavcodec     57. 51.100 / 57. 51.100
     libavformat    57. 46.100 / 57. 46.100
     libavdevice    57.  0.102 / 57.  0.102
     libavfilter     6. 51.100 /  6. 51.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  1.100 /  2.  1.100
    Guessed Channel Layout for Input Stream #0.0 : stereo
    Input #0, asf, from '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.wmv':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : © 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
     Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s
       Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 192 kb/s
       Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x720, 5942 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc
    Unknown encoder 'libx264'

    My question is what to do next ? I have wasted 3 days to make this work and this is the furthest I have come. How can I test if libx264 is installed corectly ? And if it is not installed corectly how cand I reinstal or make it work ?

    After a few modifications

    I have used an already installed ffmpeg, and removed a few commands (that were by default the same) and this time I used only the command line.

    The request

    '/home/user/working/vendors/install/ffmpeg-git-20160813-64bit-static/ffmpeg' '-y' '-i' '/home/user/working/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.wmv' '-async' '1' '-metadata:s:v:0' 'start_time=0' '-vcodec' 'libx264' '-c:a' 'aac' '-b:v' '1000k' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes57b053ce14a12ljm8a/pass-57b053ce14ad3' '/home/user/working/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.mp4'

    The new result :

    ffmpeg version N-81328-gceab04f-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 5.4.1 (Debian 5.4.1-1) 20160803
     configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --enable-libzimg --cc=gcc-5
     libavutil      55. 28.100 / 55. 28.100
     libavcodec     57. 51.102 / 57. 51.102
     libavformat    57. 46.101 / 57. 46.101
     libavdevice    57.  0.102 / 57.  0.102
     libavfilter     6. 51.100 /  6. 51.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  1.100 /  2.  1.100
     libpostproc    54.  0.100 / 54.  0.100
    Guessed Channel Layout for Input Stream #0.0 : stereo
    Input #0, asf, from '/home/user/working/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.wmv':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : © 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
     Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s
       Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 192 kb/s
       Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x720, 5942 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc
    -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
    [libx264 @ 0x442f5c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x442f5c0] ratecontrol_init: can't open stats file
    Output #0, mp4, to '/home/user/working/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.mp4':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : © 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
       Stream #0:0(eng): Unknown: none
       Metadata:
         start_time      : 0
         encoder         : Lavc57.51.102 libx264
       Stream #0:1(eng): Unknown: none
       Metadata:
         encoder         : Lavc57.51.102 aac
    Stream mapping:
     Stream #0:1 -> #0:0 (vc1 (native) -> h264 (libx264))
     Stream #0:0 -> #0:1 (wmav2 (native) -> aac (native))
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height