[FFmpeg-user] randomly named png to mp4: ffmpeg

Tyler Rinker tyler.rinker at gmail.com
Wed Jan 15 02:02:42 CET 2014


I have a directory with randomly named png files (`a.png b.png c.png`) I
want to stitch together in a particular order.

When the names follow a specific format I use:

    ffmpeg -r 4 -i image-%07d.png -c:v libx264 -r 4 -pix_fmt yuv420p out.mp4

and it works well.  But when the names are random I tried:

I tried:

    ffmpeg -r 4 -i a.png b.png c.png -c:v libx264 -r 4 -pix_fmt yuv420p
out.mp4

but it outputs a video with `a.png` only; I also tried:

    cat C:\Users\trinker\Desktop\raw3*.png | ffmpeg -f image2pipe -r 1
-vcodec png -i - -vcodec libx264 out.mp4

I'd really like to specify the order manually as I attempted with my first
attempt.

First attempt output:

    C:\Users\trinker\Desktop\raw3>ffmpeg -r 4 -i a.png b.png c.png -c:v
libx264 -r 4
     -pix_fmt yuv420p outty.mp4
    ffmpeg version N-59815-gb79bccb Copyright (c) 2000-2014 the FFmpeg
developers
      built on Jan 13 2014 22:01:47 with gcc 4.8.2 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetyp
    e --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --ena
    ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-l
    ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libsp
    eex --enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvo-aa
    cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavp
    ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil      52. 62.100 / 52. 62.100
      libavcodec     55. 48.101 / 55. 48.101
      libavformat    55. 23.103 / 55. 23.103
      libavdevice    55.  5.102 / 55.  5.102
      libavfilter     4.  1.100 /  4.  1.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, image2, from 'a.png':
      Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: png, rgb24, 720x480 [SAR 25:21 DAR 25:14], 25
tbr, 25 tb
    n, 25 tbc
    File 'b.png' already exists. Overwrite ? [y/N] y
    File 'c.png' already exists. Overwrite ? [y/N] y
    [libx264 @ 0258aec0] using SAR=25/21
    [libx264 @ 0258aec0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX
    [libx264 @ 0258aec0] profile High, level 2.2
    [libx264 @ 0258aec0] 264 - core 140 r2377 1ca7bb9 - H.264/MPEG-4 AVC
codec - Cop
    yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deb
    lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chro
    ma_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=4 scenec
    ut=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, image2, to 'b.png':
      Metadata:
        encoder         : Lavf55.23.103
        Stream #0:0: Video: png, rgb24, 720x480 [SAR 25:21 DAR 25:14],
q=2-31, 200 k
    b/s, 90k tbn, 4 tbc
    Output #1, image2, to 'c.png':
      Metadata:
        encoder         : Lavf55.23.103
        Stream #1:0: Video: png, rgb24, 720x480 [SAR 25:21 DAR 25:14],
q=2-31, 200 k
    b/s, 90k tbn, 4 tbc
    Output #2, mp4, to 'outty.mp4':
      Metadata:
        encoder         : Lavf55.23.103
        Stream #2:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 720x48
    0 [SAR 25:21 DAR 25:14], q=-1--1, 16384 tbn, 4 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (png -> png)
      Stream #0:0 -> #1:0 (png -> png)
      Stream #0:0 -> #2:0 (png -> libx264)
    Press [q] to stop, [?] for help
    frame=    1 fps=0.0 q=0.0 Lq=0.0 q=22.0 size=N/A time=00:00:00.25
bitrate=N/A

    video:777kB audio:0kB subtitle:0 global headers:0kB muxing overhead
-100.002767%

    [libx264 @ 0258aec0] frame I:1     Avg QP:20.37  size: 17566
    [libx264 @ 0258aec0] mb I  I16..4: 15.9% 79.0%  5.0%
    [libx264 @ 0258aec0] 8x8 transform intra:79.0%
    [libx264 @ 0258aec0] coded y,uvDC,uvAC intra: 68.4% 85.0% 46.3%
    [libx264 @ 0258aec0] i16 v,h,dc,p: 78% 10%  6%  6%
    [libx264 @ 0258aec0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 18%  3%  4%
 3%  5%
     5%  4%
    [libx264 @ 0258aec0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 14%  8%  5% 15%
 6% 17%
     6%  3%
    [libx264 @ 0258aec0] i8c dc,h,v,p: 31% 17% 42% 10%
    [libx264 @ 0258aec0] kb/s:562.11


Second attempt output:


    cat C:\Users\trinker\Desktop\raw3*.png | ffmpeg -f image2pipe -r 1
-vcodec png -i - -vcodec libx264 out.mp4
    cygwin warning:
      MS-DOS style path detected: C:\Users\trinker\Desktop\raw3*.png
      Preferred POSIX equivalent is:
/cygdrive/c/Users/trinker/Desktop/raw3*.png
      CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
      Consult the user's guide for more details about POSIX paths:
        http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
    cat: C:\Users\trinker\Desktop\raw3*.png: No such file or directory
    ffmpeg version N-59815-gb79bccb Copyright (c) 2000-2014 the FFmpeg
developers
      built on Jan 13 2014 22:01:47 with gcc 4.8.2 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
      libavutil      52. 62.100 / 52. 62.100
      libavcodec     55. 48.101 / 55. 48.101
      libavformat    55. 23.103 / 55. 23.103
      libavdevice    55.  5.102 / 55.  5.102
      libavfilter     4.  1.100 /  4.  1.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
      libpostproc    52.  3.100 / 52.  3.100
    [image2pipe @ 02a60900] Could not find codec parameters for stream 0
(Video: png): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize'
options
    pipe:: could not find codec parameters

I'm on Windows 7 if it makes a difference.


More information about the ffmpeg-user mailing list