Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • Convert .png segment of HLS to mp3

    25 avril, par Maxim

    I have url of HLS:

    https://9str-m3u8-play-021024.playm4u.xyz/m3u8/tp1-rdv1/1080/642bce856edd7cab511931a2/647af249adaf446b461a374e/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/2a2415eaeec82cbf16cebbf974a372e0

    It contains links to segments:

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:6
    #EXT-X-PLAYLIST-TYPE:VOD
    #EXTINF:6,
    https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007927d1e7a824e88d90e17fc925d914a006873ed08c7ecb7107e7a72b810e66a2cf/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c37bc9a36794c836b2cc1c80b4c82aff3e/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/96902c1c0db5b15f08a07d5264361f76
    #EXTINF:6,
    https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007927d1e7a824e88d90e17fc925d914a0066544f42d5295cd71e2423a54702ca79a/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c3fa2a9b2a1346c4d1e2dc5c86583c6eca67d125b9be8ecfee724eea988e5948be/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/8e029c34700e193599b52db66deeb735
    ...
    #EXTINF:6,
    https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007923834b9bbcad67c4f65be31cff40707486e081644f595435073518177e606a22/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c3ddcf230599d82c80aa1c0d846a87eccbd425fffb2434464a4aea5eecb13bf477/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/63ae374ce1012f9b702a082f691edfd8
    #EXTINF:2.24,
    https://9str-rd.playm4u.xyz/9str-rd-tp1v1/1080/642bce856edd7cab511931a2/cdebe91fd08cdb6d79827cca6c41007923834b9bbcad67c4f65be31cff407074bce293bef2086d37ff74c808d35023d5/0292b734e3b0d7dacb586869beac1f91281543d90d0496d24f01bbaf70c971c3514fc67bd369ecc7b2b8d0fa501094d2da0625e9796bde32b6f9a9cb5d278ec3/53616c7465645f5f3ec139a78aff102a8e3a3c62ae8f3826f32bf6f19ea4b1fb/1735825697/ae04e0aa6d021a973852ee444489eec0
    #EXT-X-ENDLIST
    

    I can download any segment and play it using ExoPlayer in Android, but I can't convert it to mp3 or mp4 using ffmpeg.

    For example this command:

    ffmpeg -i /Users/user1/Downloads/response0.png /Users/user1/Downloads/response0.mp3
    

    returns this:

      libavutil      59. 39.100 / 59. 39.100
      libavcodec     61. 19.100 / 61. 19.100
      libavformat    61.  7.100 / 61.  7.100
      libavdevice    61.  3.100 / 61.  3.100
      libavfilter    10.  4.100 / 10.  4.100
      libswscale      8.  3.100 /  8.  3.100
      libswresample   5.  3.100 /  5.  3.100
      libpostproc    58.  3.100 / 58.  3.100
    Input #0, png_pipe, from '/Users/user1/Downloads/response0.png':
      Duration: N/A, bitrate: N/A
      Stream #0:0: Video: png, ya8(pc, gbr/unknown/unknown), 1x1, 25 fps, 25 tbr, 25 tbn
    Output #0, mp3, to '/Users/user1/Downloads/response0.mp3':
    [out#0/mp3 @ 0x7fe879206b00] Output file does not contain any stream
    Error opening output file /Users/user1/Downloads/response0.mp3.
    Error opening output files: Invalid argument
    

    (response0.png is the first downloaded segment from hls)

    I think that "Stream #0:0: Video: png ..." means that this file is in png format, and it does not have audio track. But it has audio track, because I can play it.

    Probably segments are in some non-standard format, but how to find out what format is it?

    PS1

    Link to response0.png:

    https://i.sstatic.net/pajvO7fg.png

    or

    https://drive.google.com/file/d/1i-LERY8kEYVZgS8mX9mCoMWd3To4Fk2T/view?usp=sharing

    PS2

    This command:

    file /Users/user1/Downloads/response0.png
    

    returns this:

    /Users/user1/Downloads/response0.png: PNG image data, 1 x 1, 8-bit gray+alpha, non-interlaced
    

    PS3:

    This command:

    xxd /Users/user1/Downloads/response0.png | head -4
    

    returns this:

    /Users/user1/Downloads/response0.png: PNG image data, 1 x 1, 8-bit gray+alpha, non-interlaced
    user1@MBP-Maxim-2 temp % xxd /Users/user1/Downloads/response0.png | head -4
    00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
    00000010: 0000 0001 0000 0001 0804 0000 00b5 1c0c  ................
    00000020: 0200 0000 0b49 4441 5478 da63 64f8 0f00  .....IDATx.cd...
    00000030: 0105 0101 2718 e366 0000 0000 4945 4e44  ....'..f....IEND
    

    PS4:

    web-page with video:

    https://ww2.movie123.club/watch/tci7-pulp-fiction-1994-movie-online-free-123movies.html

  • How to Install ffmpeg on aws lambda machine ?

    25 avril, par Martin Blaustein

    I'm trying to run a node js script on AWS lambda that uses ffmpeg. To do this, I need to install ffmpeg on the machine itself.

    I have looked through the documentation but I could not find how to connect to the machine that runs the lambda.

  • Remove Rotate metadata from mp4

    25 avril, par mbajur

    I'm trying to remove or modify a rotate param from my mp4 file using ffmpeg. Based on some google results, i've ended up with such command (i've tried a few more but none of them worked):

    $ ffmpeg -i ./source.mp4 -metadata rotate=0 ./output.mp4
    

    But it's not working at all. The rotate=270 metadata param is still there in the output file. Can you please advise me on how it should be done?

    I'm using

    ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
      built on Dec  9 2013 20:00:03 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
    

    Output:

    ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
      built on Dec  9 2013 20:00:03 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
      libavutil      52. 18.100 / 52. 18.100
      libavcodec     54. 92.100 / 54. 92.100
      libavformat    54. 63.104 / 54. 63.104
      libavdevice    54.  3.103 / 54.  3.103
      libavfilter     3. 42.103 /  3. 42.103
      libswscale      2.  2.100 /  2.  2.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  2.100 / 52.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/michal/Downloads/mp4_c8ffe9a587b126f152ed3d89a146b445.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf54.63.104
      Duration: 00:00:13.80, start: 0.021333, bitrate: 437 kb/s
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 313 kb/s, 7.50 fps, 7.50 tbr, 15360 tbn, 15 tbc
        Metadata:
          rotate          : 270
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 134 kb/s
        Metadata:
          handler_name    : SoundHandler
    File '/Users/michal/Desktop/mp4.mp4' already exists. Overwrite ? [y/N] y 
    using SAR=1/1
    [libx264 @ 0x7fb17b01ec00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
    [libx264 @ 0x7fb17b01ec00] profile High, level 2.2
    [libx264 @ 0x7fb17b01ec00] 264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=7 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 '/Users/michal/Desktop/mp4.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        rotate          : 0
        encoder         : Lavf54.63.104
        Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 15360 tbn, 7.50 tbc
        Metadata:
          rotate          : 270
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s
        Metadata:
          handler_name    : SoundHandler
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> libx264)
      Stream #0:1 -> #0:1 (aac -> libfaac)
    Press [q] to stop, [?] for help
    frame=   99 fps= 39 q=32766.0 Lsize=     730kB time=00:00:13.80 bitrate= 433.1kbits/s    
    video:497kB audio:226kB subtitle:0 global headers:0kB muxing overhead 0.821272%
    [libx264 @ 0x7fb17b01ec00] frame I:8     Avg QP:14.85  size: 11183
    [libx264 @ 0x7fb17b01ec00] frame P:68    Avg QP:17.68  size:  5348
    [libx264 @ 0x7fb17b01ec00] frame B:23    Avg QP:18.26  size:  2419
    [libx264 @ 0x7fb17b01ec00] consecutive B-frames: 53.5% 46.5%  0.0%  0.0%
    [libx264 @ 0x7fb17b01ec00] mb I  I16..4: 31.9% 55.9% 12.1%
    [libx264 @ 0x7fb17b01ec00] mb P  I16..4:  8.2%  9.1%  0.3%  P16..4: 54.3% 13.0%  7.6%  0.0%  0.0%    skip: 7.4%
    [libx264 @ 0x7fb17b01ec00] mb B  I16..4:  0.2%  0.2%  0.0%  B16..8: 49.9%  4.0%  0.3%  direct: 8.6%  skip:36.8%  L0:45.5% L1:50.9% BI: 3.6%
    [libx264 @ 0x7fb17b01ec00] 8x8 transform intra:53.3% inter:90.4%
    [libx264 @ 0x7fb17b01ec00] coded y,uvDC,uvAC intra: 41.7% 90.1% 55.3% inter: 23.9% 56.7% 7.1%
    [libx264 @ 0x7fb17b01ec00] i16 v,h,dc,p: 12% 20% 10% 59%
    [libx264 @ 0x7fb17b01ec00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 20% 28%  8%  8%  4%  8%  5%  5%
    [libx264 @ 0x7fb17b01ec00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 23% 18%  6% 11%  5%  8%  3%  3%
    [libx264 @ 0x7fb17b01ec00] i8c dc,h,v,p: 57% 22% 18%  4%
    [libx264 @ 0x7fb17b01ec00] Weighted P-Frames: Y:5.9% UV:0.0%
    [libx264 @ 0x7fb17b01ec00] ref P L0: 61.2%  2.2% 23.5% 12.5%  0.6%
    [libx264 @ 0x7fb17b01ec00] ref B L0: 74.2% 25.8%
    [libx264 @ 0x7fb17b01ec00] kb/s:308.34
    
  • Converting DAV to MP4 and OGG

    25 avril, par mackowiakp

    I want to prepare WEB page containing films from security camera recorders. Each recorder transmit video files in DAV format so each film is converted to MP4 format by script, using such syntax:

    ffmpeg -y -i movie.dav -vcodec libx264 -crf 24 movie.mp4
    

    So I included in HTMLv5 code such entry:

      
    

    It works correctly with Chrome but not with Firefox. For proper work in FF it is necessary add link to OGG file. So correct HTMLv5 syntax for both browsers should look like this:

     
    

    Can anybody help me to pass correct ffmpeg syntax to create OGG file?

    Output from console after using -movflags +faststart options

    [maciek@piotr MMM]$ ../ffmpeg-2.4.2-64bit-static/ffmpeg -movflags +faststart -y -i   04.24.23-04.24.38\[M\]\[@0\]\[0\].dav -vcodec libx264 -crf 24 10.mp4
    ffmpeg version 2.4.2-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2014 the FFmpeg developers
      built on Oct  9 2014 07:24:56 with gcc 4.8 (Debian 4.8.3-11)
      configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --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-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8
      libavutil      54.  7.100 / 54.  7.100
      libavcodec     56.  1.100 / 56.  1.100
      libavformat    56.  4.101 / 56.  4.101
      libavdevice    56.  0.100 / 56.  0.100
      libavfilter     5.  1.100 /  5.  1.100
      libswscale      3.  0.100 /  3.  0.100
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  0.100 / 53.  0.100
    Option movflags not found.
    
  • How to cleanup data to reuse ffmpeg.wasm instance

    24 avril, par rickyz

    I have multiple files that I am trying to process back to back using ffmpeg.wasm. I have noticed that after around ~150 runs, a memory issue comes up: RuntimeError: memory access out of bounds. I tried doing cleanup using ffmpeg.deleteFile() on both the input and output files after every run, but that didn't make a difference. Is there something I am missing that will allow me to reuse the ffmpeg instance as many times as I want?

    If I can avoid it, I do not want to have to call ffmpeg.terminate() after each use since loading ffmpeg for the next use takes a long time (~.5 secs on my test machine).

    Note: I am using the updated ffmpeg.wasm v0.12+ in a browser setting