[FFmpeg-user] Create thumbnails from RTMP stream

Grant Curtis codercurtis at gmail.com
Tue Apr 26 00:39:07 CEST 2016


If I use Flash Media Live Encoder to send a stream to an RTMP server, and
then, on that server, run the below command, I can create thumbnails from
the stream.

But when I try to do the same when I stream the file to the server using
ffmpeg, I get errors, and no thumbnails are created

Server command and output:

$ /usr/bin/ffmpeg -report -i
"rtmp://localhost:1935/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1"
-y -r 29.97 -threads 4 -c:v copy -c:a copy
/mnt_ephemeral1/media/cumin/cumin_1000.mp4 -filter:v "scale=w=178:h=100" -f
image2 -vf "fps=fps=1/5"
"/mnt_ephemeral1/media/cumin/cumin/thumbs/thumb_%04d.png"
ffmpeg started on 2016-04-25 at 18:28:39
Report written to "/var/log/ffmpeg/ffmpeg-20160425-182839.log"
ffmpeg version 2.7.2-static http://johnvansickle.com/ffmpeg/  Copyright (c)
2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (Debian 4.9.3-1)
  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 --enable-libass
--enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
[NULL @ 0x31b65e0] missing picture in access unit with size 110664
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 2338
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 2645
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 2600
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 8421
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 2895
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 1759
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 776
[h264 @ 0x31b65e0] no frame!
[h264 @ 0x31b65e0] missing picture in access unit with size 13391
[h264 @ 0x31b65e0] no frame!
-truncated a bunch more similar messages-
[flv @ 0x31b3c00] decoding for stream 0 failed
[flv @ 0x31b3c00] Could not find codec parameters for stream 0 (Video:
h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
Input #0, flv, from
'rtmp://localhost:1935/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1':
  Metadata:
    moovPosition    : 36
    avcprofile      : 100
    avclevel        : 31
    videoframerate  : 25
    audiochannels   : 2
    timescale       : 1000
    length          : 839
    sampletype      : .mp3
  Duration: 00:00:00.84, start: 0.040000, bitrate: N/A
    Stream #0:0: Video: h264, none, 25 tbr, 1k tbn, 2k tbc
    Stream #0:1: Subtitle: text
    Stream #0:2: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Output #1, image2, to
'/mnt_ephemeral1/media/cumin/cumin/thumbs/thumb_%04d.png':
  Metadata:
    moovPosition    : 36
    avcprofile      : 100
    avclevel        : 31
    videoframerate  : 25
    audiochannels   : 2
    timescale       : 1000
    length          : 839
    sampletype      : .mp3
Output file #1 does not contain any stream
Received signal 2: terminating.

---

Here's how I start the stream from my local machine:

---

 ffmpeg -re -i testVideo.mp4 -ar 44100 -c:v libx264 -f flv
rtmp://xxxxxxxx:1935/xxxxx/xxxxx/xxxxx_1000.mp4
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (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-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype
--enable-libgme --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-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma
--enable-decklink --enable-zlib
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testVideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.24.2
  Duration: 00:01:02.32, start: 0.000000, bitrate: 1347 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 959 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1,
fltp, 383 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
[libx264 @ 03052340] using SAR=1/1
[libx264 @ 03052340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
FMA3 AVX2 LZCNT BMI2
[libx264 @ 03052340] profile High, level 3.1
[libx264 @ 03052340] 264 - core 148 r2638 7599210 - 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=-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, flv, to 'rtmp://xxxxxx:1935/xxxx/xxxxx/xxxxx_1000.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
    Stream #0:0(und): Video: h264 (libx264) ([7][0][0][0] / 0x0007),
yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc
(default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
      encoder         : Lavc56.60.100 libx264
    Stream #0:1(und): Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002),
44100 Hz, stereo, fltp (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
      encoder         : Lavc56.60.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame= 1336 fps= 25 q=28.0 size=    7310kB time=00:00:53.63
bitrate=1116.6kbits/s


More information about the ffmpeg-user mailing list