Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • php || ubuntu about — (PID)

    13 janvier 2018, par Mahmoud Khatib

    Is there any way to manually set the pid when executing the command line ??

    If not, is there a way to learn the pid for the last process?

    i tried pgrep $name but it gives more than one pid

    -------update--------- what i am trying to do is

     $command =  'ffmpeg -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -
     reconnect_delay_max 2000 -i '.$streamurl.' -c:v copy -c:a aac -ar 44100 -ab 
     128k -ac 2 -strict -2 -f flv '.$rtmp.'' . ' > /dev/null 2>&1 & echo $!; ';
    

    this how i am tring to get the id and it will work only for the first command

    $command_get_pid =  'pgrep ffmpeg';
    $procid = shell_exec($command_get_pid);
    

    now if i exec the command one more time the pgrep ffmpeg will return 2 (pid)

  • ffmeg does not convert all of the frames to video

    13 janvier 2018, par Z.Grey

    I have in total 7 frames and try to convert them a slideshow video. But whatever I tried with ffmeg I always end up with only 3 frames, here is my codes ffmpeg -f image2 -i gif%01d.png -vframes 7 test.mp4

    The sequence of images is gif0.png gif1.png.. gif6.png. I want all of them show up in the video but unfortunately, I always have the first 3 images in the video. Would you give a hint to convert all the frames to the video, please? The log file

     [zgrey@skyler:Zelda]$ ffmpeg -f image2 -i gif%01d.png -vframes 7 test.mp4
    ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
      configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg
      libavutil      55. 58.100 / 55. 58.100
      libavcodec     57. 89.100 / 57. 89.100
      libavformat    57. 71.100 / 57. 71.100
      libavdevice    57.  6.100 / 57.  6.100
      libavfilter     6. 82.100 /  6. 82.100
      libavresample   3.  5.  0 /  3.  5.  0
      libswscale      4.  6.100 /  4.  6.100
      libswresample   2.  7.100 /  2.  7.100
      libpostproc    54.  5.100 / 54.  5.100
    Input #0, image2, from 'gif%01d.png':
      Duration: 00:00:00.28, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: png, pal8(pc), 736x727 [SAR 72:72 DAR 736:727], 25 fps, 25 tbr, 25 tbn, 25 tbc
    File 'test.mp4' already exists. Overwrite ? [y/N] y
    Stream mapping:
      Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    No pixel format specified, yuv444p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0x3a9fee0] using SAR=1/1
    [libx264 @ 0x3a9fee0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x3a9fee0] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
    [libx264 @ 0x3a9fee0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=4 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
    Output #0, mp4, to 'test.mp4':
      Metadata:
        encoder         : Lavf57.71.100
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 736x727 [SAR 1:1 DAR 736:727], q=-1--1, 25 fps, 12800 tbn, 25 tbc
        Metadata:
          encoder         : Lavc57.89.100 libx264
        Side data:
          cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    frame=    7 fps=0.0 q=-1.0 Lsize=     107kB time=00:00:00.16 bitrate=5496.7kbits/s speed=0.264x    
    video:106kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.860164%
    [libx264 @ 0x3a9fee0] frame I:1     Avg QP:24.11  size: 77212
    [libx264 @ 0x3a9fee0] frame P:2     Avg QP:30.73  size:  6544
    [libx264 @ 0x3a9fee0] frame B:4     Avg QP:32.11  size:  4516
    [libx264 @ 0x3a9fee0] consecutive B-frames: 14.3% 28.6%  0.0% 57.1%
    [libx264 @ 0x3a9fee0] mb I  I16..4:  5.2% 63.8% 31.0%
    [libx264 @ 0x3a9fee0] mb P  I16..4:  0.4%  2.3%  5.6%  P16..4:  5.3%  0.5%  0.1%  0.0%  0.0%    skip:85.8%
    [libx264 @ 0x3a9fee0] mb B  I16..4:  0.2%  0.3%  3.8%  B16..8:  5.5%  0.3%  0.1%  direct: 0.1%  skip:89.6%  L0:47.4% L1:52.3% BI: 0.3%
    [libx264 @ 0x3a9fee0] 8x8 transform intra:52.1% inter:31.9%
    [libx264 @ 0x3a9fee0] coded y,u,v intra: 81.0% 45.2% 41.2% inter: 0.6% 0.5% 0.4%
    [libx264 @ 0x3a9fee0] i16 v,h,dc,p: 18% 30% 43%  9%
    [libx264 @ 0x3a9fee0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 19% 36%  5%  5%  5%  7%  5%  7%
    [libx264 @ 0x3a9fee0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 26% 16%  6%  6%  5%  7%  4%  6%
    [libx264 @ 0x3a9fee0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x3a9fee0] ref P L0: 32.6%  5.7% 45.0% 16.7%
    [libx264 @ 0x3a9fee0] ref B L0: 78.1% 21.9%
    [libx264 @ 0x3a9fee0] ref B L1: 96.7%  3.3%
    [libx264 @ 0x3a9fee0] kb/s:3096.03
    
  • Trying to tonemap 14-bit grayscale video

    12 janvier 2018, par Trevor

    I'm trying to generate h.264 video from raw 2-byte gray video (14-bit range encoded in 16-bit values). I can do something like:

    ffmpeg -f rawvideo -pix_fmt gray16le -s:v 1280x720 -r 60 -i input.raw -c:v libx264 output.mp4
    

    And I get video but it's pretty dark, not sure if it's clipping, doing a linear remap, or storing the 16-bit data and VLC is doing the remap. ffprobe is reporting Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuvj444p(pc), 1280x720, 108 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc

    I was figuring I'd use the tonemap filter to make a better mapping. I added a filter before the output file with -vf.

    • tonemap=hable errors Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
    • zscale=transfer=linear,tonemap=hable errors Impossible to convert between the formats supported by the filter 'Parsed_tonemap_1' and the filter 'auto_scaler_1'
    • zscale=transfer=linear,tonemap=hable,zscale=transfer=bt709,format=yuvj444p errors code 3074: no path between colorspaces

    I'm not sure where to proceed from here...

  • Appending .ts video clip to m3u8 HLS stream

    12 janvier 2018, par JonnyHarper

    I'm trying to concat multiple streams together without the need to re-encode the videos by using an m3u8 manifest.

    The start of every video is the same, as is the end, with a short middle section which has over 7000 variations. What I'm wanting to do is create 7000+ m3u8 files, each of which merges the generic intro, the bespoke middle section and the generic end together to form one HLS stream. Is this possible?

    Here's the m3u8 file which is generated by ffmpeg:

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:12
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-PLAYLIST-TYPE:VOD
    #EXTINF:11.520000,
    3_1080p_000.ts
    #EXTINF:9.600000,
    3_1080p_001.ts
    #EXTINF:9.600000,
    3_1080p_002.ts
    #EXTINF:9.600000,
    3_1080p_003.ts
    #EXTINF:11.520000,
    3_1080p_004.ts
    #EXTINF:8.440000,
    3_1080p_005.ts
    #EXT-X-ENDLIST
    

    I tried adding an extra clip in at the end (also at the start) which also has duration 8.440000 seconds as per the following:

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:12
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-PLAYLIST-TYPE:VOD
    #EXTINF:11.520000,
    3_1080p_000.ts
    #EXTINF:9.600000,
    3_1080p_001.ts
    #EXTINF:9.600000,
    3_1080p_002.ts
    #EXTINF:9.600000,
    3_1080p_003.ts
    #EXTINF:11.520000,
    3_1080p_004.ts
    #EXTINF:8.440000,
    3_1080p_005.ts
    #EXTINF:8.440000,
    4_1080p_005.ts
    #EXT-X-ENDLIST
    

    When I try run this, flowplayer detects the updated length and the stream plays but when it gets to playing the appended clip, it skips back to the start as though it's stopped. Any help would be massively appreciated, otherwise I'm going to have to render each video out in full and there's 7000+ to do!

    The problem stream is available to view here. It ends at 1min exactly instead of going to 1:08.

    Thanks in advance.

  • how to debug a corrupted video file with ffmpeg ?

    12 janvier 2018, par Blurry Script

    for example I downloaded some film, it is somehow encoded with some program, when I try to use ffmpeg to convert it, let's say from mkv to mp4, i get an error that:

    [matroska,webm @ 0x1d06640] Read error at pos. 2241497 (0x2233d9)
    

    now how can I know where is the reason that this happens? should just avoid this kind of files, or somehow debug it and see what is the reason behind this error? or maybe skip this error frames, but i dont know how many frames may be like this, what if most of the file is filled with corrupted frames, altough it is playable in the video player