Recherche avancée

Médias (1)

Mot : - Tags -/blender

Autres articles (49)

  • 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 (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • 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 (4431)

  • ffmpeg : trim / concat results in different length videos

    4 mai 2019, par Mads Lee Jensen

    Im experimenting with the trim and concat filters.

    I wanted to simply split up a video into X chunks, and concat it again. I expected the result would be a video with same frames / duration.

    So i have a video encoded with 1 fps and contains 3 frames, the duration of this video is 3 seconds.

    i run the following script

    ffmpeg -y -i fps.mp4 -an -filter_complex "[0:v]trim=0:1[v1];[0:v]trim=1:2[v2];[0:v]trim=2:3[v3];[v1][v2][v3]  concat=n=3:v=1 [out]" -map [out] out.mp4

    The result is a video with a duration of 4 seconds to inspect the problem i called :

    ffprobe -print_format json -show_frames out.mp4

    It shows that there is now 4 frames ?? (here is the dump)

    ffprobe version 4.1.3 Copyright (c) 2007-2019 the FFmpeg developers
     built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    {
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.20.100
     Duration: 00:00:04.00, start: 0.000000, bitrate: 4 kb/s
       Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 100x100, 2 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       "frames": [
           {
               "media_type": "video",
               "stream_index": 0,
               "key_frame": 1,
               "pkt_pts": 0,
               "pkt_pts_time": "0.000000",
               "pkt_dts": 0,
               "pkt_dts_time": "0.000000",
               "best_effort_timestamp": 0,
               "best_effort_timestamp_time": "0.000000",
               "pkt_duration": 16384,
               "pkt_duration_time": "1.000000",
               "pkt_pos": "48",
               "pkt_size": "857",
               "width": 100,
               "height": 100,
               "pix_fmt": "yuv444p",
               "pict_type": "I",
               "coded_picture_number": 0,
               "display_picture_number": 0,
               "interlaced_frame": 0,
               "top_field_first": 0,
               "repeat_pict": 0,
               "chroma_location": "left"
           },
           {
               "media_type": "video",
               "stream_index": 0,
               "key_frame": 0,
               "pkt_pts": 16384,
               "pkt_pts_time": "1.000000",
               "pkt_dts": 16384,
               "pkt_dts_time": "1.000000",
               "best_effort_timestamp": 16384,
               "best_effort_timestamp_time": "1.000000",
               "pkt_duration": 16384,
               "pkt_duration_time": "1.000000",
               "pkt_pos": "1053",
               "pkt_size": "146",
               "width": 100,
               "height": 100,
               "pix_fmt": "yuv444p",
               "pict_type": "B",
               "coded_picture_number": 2,
               "display_picture_number": 0,
               "interlaced_frame": 0,
               "top_field_first": 0,
               "repeat_pict": 0,
               "chroma_location": "left"
           },
           {
               "media_type": "video",
               "stream_index": 0,
               "key_frame": 0,
               "pkt_pts": 32768,
               "pkt_pts_time": "2.000000",
               "best_effort_timestamp": 32768,
               "best_effort_timestamp_time": "2.000000",
               "pkt_duration": 16384,
               "pkt_duration_time": "1.000000",
               "pkt_pos": "1199",
               "pkt_size": "19",
               "width": 100,
               "height": 100,
               "pix_fmt": "yuv444p",
               "pict_type": "B",
               "coded_picture_number": 3,
               "display_picture_number": 0,
               "interlaced_frame": 0,
               "top_field_first": 0,
               "repeat_pict": 0,
               "chroma_location": "left"
           },
           {
               "media_type": "video",
               "stream_index": 0,
               "key_frame": 0,
               "pkt_pts": 49152,
               "pkt_pts_time": "3.000000",
               "best_effort_timestamp": 49152,
               "best_effort_timestamp_time": "3.000000",
               "pkt_duration": 16384,
               "pkt_duration_time": "1.000000",
               "pkt_pos": "905",
               "pkt_size": "148",
               "width": 100,
               "height": 100,
               "pix_fmt": "yuv444p",
               "pict_type": "P",
               "coded_picture_number": 1,
               "display_picture_number": 0,
               "interlaced_frame": 0,
               "top_field_first": 0,
               "repeat_pict": 0,
               "chroma_location": "left"
           }
       ]
    }

    I tried different things, and everything seems to work fine if i split a 2 second video (still 1 fps) up and concat again. But something goes wrong when going beyond that ?

    Here is output from ffmpeg -i fps.mp4

    ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
     built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'scripts/fps.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.20.100
     Duration: 00:00:03.00, start: 0.000000, bitrate: 7 kb/s
       Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 100x100, 4 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc (default)
       Metadata:
         handler_name    : VideoHandler
  • Trying to concatenate multiple videos with multiple audio streams using ffmpeg

    25 avril 2019, par Toto

    I’m trying to concatenate 3 mp4 videos, each contains 3 audio streams using ffmpeg, since I couldn’t merge them with other software because of differences in the codecs private data.

    Since the files have different codecs I’m trying to use the concat video filter but I can’t seem to get it to work. The output turns out to be an unplayable file. I’m trying to specify the input files, and every media stream, then telling the software to concatenate it and copy it to the output file.

    ffmpeg -i A.mp4 -i B.mp4 -i C.mp4 -filter_complex  '[0:0] [0:1] [0:2] [0:3] [1:0] [1:1] [1:2] [1:3] [2:0] [2:1] [2:2] [2:3] concat=n=3:v=1:a=3 [v] [a1] [a2] [a3]'  -map '[v]' -map '[a1]' -map '[a2]'-map '[a3]' output.mp4

    The complete log :

    ffmpeg -i A.mp4 -i B.mp4 -i C.mp4 -filter_complex  '[0:0] [0:1] [0:2] [0:3] [1:0] [1:1] [1:2] [1:3] [2:0] [2:1] [2:2] [2:3] concat=n=3:v=1:a=3 [v] [a1] [a2] [a3]'  -map '[v]' -map '[a1]' -map '[a2]'-map '[a3]' output.mp4
    ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 8.2.1 (GCC) 20190212
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'A.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : HandBrake 0.10.1 2015030800
     Duration: 01:59:10.12, start: 0.000000, bitrate: 6868 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 6017 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
       Metadata:
         handler_name    : Stereo
       Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 320 kb/s
       Metadata:
         handler_name    : Surround
       Stream #0:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         handler_name    : Stereo
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'B.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : HandBrake 0.10.1 2015030800
     Duration: 01:12:28.48, start: 0.000000, bitrate: 6846 kb/s
       Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 6001 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
       Metadata:
         handler_name    : Stereo
       Stream #1:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 320 kb/s
       Metadata:
         handler_name    : Surround
       Stream #1:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         handler_name    : Stereo
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'C.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : HandBrake 0.10.1 2015030800
     Duration: 00:58:55.53, start: 0.000000, bitrate: 6850 kb/s
       Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 6005 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 319 kb/s (default)
       Metadata:
         handler_name    : Stereo
       Stream #2:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 319 kb/s
       Metadata:
         handler_name    : Surround
       Stream #2:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         handler_name    : Stereo
    Stream mapping:
     Stream #0:0 (h264) -> concat:in0:v0
     Stream #0:1 (aac) -> concat:in0:a0
     Stream #0:2 (aac) -> concat:in0:a1
     Stream #0:3 (aac) -> concat:in0:a2
     Stream #1:0 (h264) -> concat:in1:v0
     Stream #1:1 (aac) -> concat:in1:a0
     Stream #1:2 (aac) -> concat:in1:a1
     Stream #1:3 (aac) -> concat:in1:a2
     Stream #2:0 (h264) -> concat:in2:v0
     Stream #2:1 (aac) -> concat:in2:a0
     Stream #2:2 (aac) -> concat:in2:a1
     Stream #2:3 (aac) -> concat:in2:a2
     concat:out:v0 -> Stream #0:0 (libx264)
     concat:out:a0 -> Stream #0:1 (aac)
     concat:out:a1 -> Stream #0:2 (aac)
     concat:out:a2 -> Stream #0:3 (aac)
    Press [q] to stop, [?] for help
    [libx264 @ 000001930c898980] using SAR=1/1
    [libx264 @ 000001930c898980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 000001930c898980] profile High, level 4.0, 4:2:0, 8-bit
    [libx264 @ 000001930c898980] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=2 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
    Output #0, mp4, to 'output.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.20.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
       Metadata:
         encoder         : Lavc58.35.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
       Metadata:
         encoder         : Lavc58.35.100 aac
       Stream #0:2: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 341 kb/s
       Metadata:
         encoder         : Lavc58.35.100 aac
       Stream #0:3: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
       Metadata:
         encoder         : Lavc58.35.100 aac
    [aac @ 000001930d3a88c0] skip_data_stream_element: Input buffer exhausted before END element found
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 000001930c89a4c0] Number of bands (48) exceeds limit (47).ate=6048.4kbits/s dup=1 drop=0 speed=0.916x
    Error while decoding stream #2:1: Invalid data found when processing input
    frame=450571 fps= 28 q=-1.0 Lsize=11204203kB time=04:10:34.13 bitrate=6105.1kbits/s dup=1 drop=0 speed=0.939x
    video:10071486kB audio:1099256kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.299544%
    [libx264 @ 000001930c898980] frame I:4679  Avg QP:20.30  size:103274
    [libx264 @ 000001930c898980] frame P:125629 Avg QP:22.82  size: 41052
    [libx264 @ 000001930c898980] frame B:320263 Avg QP:25.08  size: 14590
    [libx264 @ 000001930c898980] consecutive B-frames:  2.3%  6.0%  8.8% 83.0%
    [libx264 @ 000001930c898980] mb I  I16..4: 16.4% 78.4%  5.2%
    [libx264 @ 000001930c898980] mb P  I16..4:  7.0% 17.1%  1.1%  P16..4: 43.0%  9.7%  4.9%  0.0%  0.0%    skip:17.3%
    [libx264 @ 000001930c898980] mb B  I16..4:  0.8%  1.7%  0.1%  B16..8: 39.4%  3.6%  0.7%  direct: 4.3%  skip:49.4%  L0:43.8% L1:50.2% BI: 6.0%
    [libx264 @ 000001930c898980] 8x8 transform intra:68.6% inter:84.9%
    [libx264 @ 000001930c898980] coded y,uvDC,uvAC intra: 40.3% 64.9% 17.2% inter: 12.9% 24.2% 0.4%
    [libx264 @ 000001930c898980] i16 v,h,dc,p: 40% 22% 10% 28%
    [libx264 @ 000001930c898980] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 15% 23%  5%  6%  7%  5%  6%  5%
    [libx264 @ 000001930c898980] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 16% 16%  6%  9%  9%  7%  6%  5%
    [libx264 @ 000001930c898980] i8c dc,h,v,p: 48% 20% 26%  6%
    [libx264 @ 000001930c898980] Weighted P-Frames: Y:8.6% UV:6.4%
    [libx264 @ 000001930c898980] ref P L0: 58.8% 12.5% 19.8%  8.4%  0.4%
    [libx264 @ 000001930c898980] ref B L0: 88.5%  9.1%  2.4%
    [libx264 @ 000001930c898980] ref B L1: 96.9%  3.1%
    [libx264 @ 000001930c898980] kb/s:5487.92
    [aac @ 000001930c899280] Qavg: 212.043
    [aac @ 000001930d1cfbc0] Qavg: 211.329
    [aac @ 000001930d1ce080] Qavg: 228.685

    This is the output when trying the concat demuxer, which also produces an unplayable file.

    ffmpeg -f concat -safe 0 -i mylist.txt -map 0 -c copy concat2.mp4
    ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 8.2.1 (GCC) 20190212
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0000025ca95f2dc0] Auto-inserting h264_mp4toannexb bitstream filter
    Input #0, concat, from 'mylist.txt':
     Duration: N/A, start: 0.000000, bitrate: 6850 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 6017 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s
       Metadata:
         handler_name    : Stereo
       Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 320 kb/s
       Metadata:
         handler_name    : Surround
       Stream #0:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         handler_name    : Stereo
    Output #0, mp4, to 'concat2.mp4':
     Metadata:
       encoder         : Lavf58.20.100
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 6017 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s
       Metadata:
         handler_name    : Stereo
       Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 320 kb/s
       Metadata:
         handler_name    : Surround
       Stream #0:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         handler_name    : Stereo
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
     Stream #0:2 -> #0:2 (copy)
     Stream #0:3 -> #0:3 (copy)
    Press [q] to stop, [?] for help
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0000025ca95f9480] Auto-inserting h264_mp4toannexb bitstream filter4x
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0000025ca95f9480] Auto-inserting h264_mp4toannexb bitstream filter5x
    frame=450570 fps=1251 q=-1.0 Lsize=12591157kB time=04:10:34.11 bitrate=6860.8kbits/s speed=41.7x
    video:11029679kB audio:1527897kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.267411%
  • "Invalid or unexpected token" error when trying to execute ffmpeg build on lambda

    4 janvier 2019, par almarc

    I have a node.js script that uses ffmpeg to convert mp4 downloaded from YT to mp3 and save to Amazon S3. Uploading using the serverless framework. The "ffmpeg" file is included in the main directory (with .yml), downloaded from here :
    https://johnvansickle.com/ffmpeg/

    The code :

    'use strict'
    process.env.PATH = process.env.PATH + ':/tmp/'
    process.env['FFMPEG_PATH'] = '/tmp/ffmpeg';
    const BIN_PATH = process.env['LAMBDA_TASK_ROOT']
    process.env['PATH'] = process.env['PATH'] + ':' + BIN_PATH;

    module.exports.download_mp3 = function (event, context, callback)
    {
     require('child_process').exec('cp /var/task/ffmpeg /tmp/.; chmod 755
     /tmp/ffmpeg;', function (error, stdout, stderr) {
     if (error)
     {
       console.log('An error occured', error);
       callback(null, null)
     }
     else
     {
       var ffmpeg = require('ffmpeg');
       const aws = require('aws-sdk')
       const s3 = new aws.S3()
       const ytdl = require('ytdl-core');

       function uploadFromStream(s3) {
         const stream = require('stream')
         var pass = new stream.PassThrough();

         var params = {Bucket: "some-bucket", Key: "some-key", Body: pass};
         s3.upload(params, function(err, data) {
           console.log(err, data);
         });
         console.log("Should be finished")
         callback(null)
       }

       let stream = ytdl("some-video-id", {
         quality: 'highestaudio',
         filter: 'audioonly'
       });

       ffmpeg(stream)
         .audioBitrate(128)
         .format('mp3')
         .on('error', (err) => console.error(err))
         .pipe(uploadFromStream(s3), {
           end: true
       });
     }})
    }

    When triggered, the function writes an error in logs :

    2019-01-04T14:50:54.525Z    21da4d49-1030-11e9-b901-0dc32b691a16    
    /var/task/ffmpeg:1
    (function (exports, require, module, __filename, __dirname) { ELF
    ^

    SyntaxError: Invalid or unexpected token
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /var/task/download.js:17:18

    It’s, most definetely, an error in the "ffmpeg" file I’ve mentioned above (link provided). But I don’t know what’s the exact issue, I followed the first answer here : https://stackoverflow.com/questions/47882810/lambda-not-connecting-to-ffmpeg to include the ffmpeg build.