[FFmpeg-user] Create thumbnails from RTMP stream

Grant Curtis codercurtis at gmail.com
Tue Apr 26 19:49:28 CEST 2016


I've simplified the command to try and get one thing working at a time.

Also, I've got it to a place where I can input the rtmp url into vlc
player, and it'll play the video I'm streaming. This rtmp url is the same
input source that the server command uses, but with `localhost` replaced
with the domain.

Local command (works)

ffmpeg -re -i testVideo.mp4 -r 29.97 -ar 44100 -c:v libx264 -f flv
rtmp://xxxxx:1935/osc-simple-ingest/cumin/mp4:cumin_1000


Server command (produces unreadable file)

/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 ./cumin_1000.mp4

log:

ffmpeg started on 2016-04-26 at 13:24:37
Report written to "ffmpeg-20160426-132437.log"
Command line:
/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 ./cumin_1000.mp4
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
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report)
with argument '1'.
Reading option '-i' ... matched as input file with argument
'rtmp://localhost:1935/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '29.97'.
Reading option '-threads' ... matched as AVOption 'threads' with argument
'4'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option './cumin_1000.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file
rtmp://localhost:1935/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1.
Successfully parsed a group of options.
Opening an input file:
rtmp://localhost:1935/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1.
[rtmp @ 0x2c01420] Handshaking...
[rtmp @ 0x2c01420] Type answer 3
[rtmp @ 0x2c01420] Server version 5.0.8.1
[rtmp @ 0x2c01420] Proto = rtmp, path =
/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1,
app = osc-live-packager/cumin?offsetFromLive=10,userID=testUser1, fname =
mp4:rebroadcast_testUser1
[rtmp @ 0x2c01420] Server bandwidth = 2500000
[rtmp @ 0x2c01420] Client bandwidth = 2500000
[rtmp @ 0x2c01420] New incoming chunk size = 4096
[rtmp @ 0x2c01420] Creating stream...
[rtmp @ 0x2c01420] Sending play command for 'mp4:rebroadcast_testUser1'
[rtmp @ 0x2c01420] New incoming chunk size = 4096
[flv @ 0x2c01ea0] Format flv probed with size=2048 and score=100
[flv @ 0x2c01ea0] Before avformat_find_stream_info() pos: 13 bytes
read:32959 seeks:0
[flv @ 0x2c01ea0] Unknown type |RtmpSampleAccess
[flv @ 0x2c01ea0] Negative cts, previous timestamps might be wrong.
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-597, dts=0, size=42467
[h264 @ 0x2c047a0] no picture
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-530, dts=0, size=2607
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-531, dts=0, size=2544
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-463, dts=0, size=2373
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 2 with DTS 0,
packet 3 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-431, dts=0, size=3147
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 3 with DTS 0,
packet 4 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-397, dts=0, size=4110
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 4 with DTS 0,
packet 5 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-330, dts=0, size=3883
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 5 with DTS 0,
packet 6 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-230, dts=0, size=6962
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 6 with DTS 0,
packet 7 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-297, dts=0, size=2950
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 7 with DTS 0,
packet 8 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-263, dts=0, size=263
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 8 with DTS 0,
packet 9 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-230, dts=0, size=1780
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 9 with DTS 0,
packet 10 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-131, dts=0, size=3245
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 10 with DTS 0,
packet 11 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-129, dts=0, size=3699
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 11 with DTS 0,
packet 12 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-64, dts=0, size=3690
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 12 with DTS 0,
packet 13 with DTS 0
[flv @ 0x2c01ea0] Invalid timestamps stream=0, pts=-29, dts=0, size=3960
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 13 with DTS 0,
packet 14 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 14 with DTS 0,
packet 15 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 15 with DTS 0,
packet 16 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 16 with DTS 0,
packet 17 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 17 with DTS 0,
packet 18 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 18 with DTS 0,
packet 19 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 19 with DTS 0,
packet 20 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 20 with DTS 0,
packet 21 with DTS 0
[flv @ 0x2c01ea0] Non-increasing DTS in stream 0: packet 21 with DTS 0,
packet 22 with DTS 0
[flv @ 0x2c01ea0] Stream discovered after head already parsed
[flv @ 0x2c01ea0] All info found
[flv @ 0x2c01ea0] rfps: 29.666667 0.019663
[flv @ 0x2c01ea0] rfps: 29.750000 0.010383
[flv @ 0x2c01ea0] rfps: 29.750000 0.010383
[flv @ 0x2c01ea0] rfps: 29.833333 0.004057
[flv @ 0x2c01ea0] rfps: 29.833333 0.004057
[flv @ 0x2c01ea0] rfps: 29.916667 0.000683
[flv @ 0x2c01ea0] rfps: 29.916667 0.000683
[flv @ 0x2c01ea0] rfps: 30.000000 0.000264
[flv @ 0x2c01ea0] rfps: 30.000000 0.000264
[flv @ 0x2c01ea0] rfps: 60.000000 0.001055
[flv @ 0x2c01ea0] rfps: 60.000000 0.001055
[flv @ 0x2c01ea0] rfps: 120.000000 0.004220
[flv @ 0x2c01ea0] rfps: 240.000000 0.016880
[flv @ 0x2c01ea0] rfps: 29.970030 0.000075
[flv @ 0x2c01ea0] rfps: 29.970030 0.000075
[flv @ 0x2c01ea0] rfps: 59.940060 0.000298
[flv @ 0x2c01ea0] rfps: 59.940060 0.000298
[flv @ 0x2c01ea0] After avformat_find_stream_info() pos: 264860 bytes
read:264860 seeks:0 frames:124
Input #0, flv, from
'rtmp://localhost:1935/osc-live-packager/cumin?offsetFromLive=10,userID=testUser1/mp4:rebroadcast_testUser1':
  Duration: N/A, start: 0.597000, bitrate: N/A
    Stream #0:0, 63, 1/1000: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1
DAR 16:9], 30.30 fps, 29.97 tbr, 1k tbn, 59.94 tbc
    Stream #0:1, 61, 1/1000: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Successfully opened the file.
Parsing a group of options: output file ./cumin_1000.mp4.
Applying option r (set frame rate (Hz value, fraction or abbreviation))
with argument 29.97.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: ./cumin_1000.mp4.
Successfully opened the file.
[mp4 @ 0x2dc98a0] Codec for stream 0 does not use global headers but
container format requires global headers
[mp4 @ 0x2dc98a0] Codec for stream 1 does not use global headers but
container format requires global headers
Output #0, mp4, to './cumin_1000.mp4':
  Metadata:
    encoder         : Lavf56.36.100
    Stream #0:0, 0, 1/11988: Video: h264 ([33][0][0][0] / 0x0021), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], q=2-31, 30.30 fps, 29.97 tbr, 11988 tbn, 29.97
tbc
    Stream #0:1, 0, 1/44100: Audio: mp3 (i[0][0][0] / 0x0069), 44100 Hz,
stereo, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 0 in output stream 0:0, replacing
by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 803 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 791 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 1606 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 1990 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 2398 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 3201 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 4400 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 3596 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 4004 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 4400 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 5586 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 5610 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 6390 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Invalid DTS: 7157 PTS: 6809 in output stream 0:0,
replacing by guess
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7157,
current: 7157; changing to 7158. This may result in incorrect timestamps in
the output file.
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7158,
current: 7157; changing to 7159. This may result in incorrect timestamps in
the output file.
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7159,
current: 7157; changing to 7160. This may result in incorrect timestamps in
the output file.
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7160,
current: 7157; changing to 7161. This may result in incorrect timestamps in
the output file.
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7161,
current: 7157; changing to 7162. This may result in incorrect timestamps in
the output file.
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7162,
current: 7157; changing to 7163. This may result in incorrect timestamps in
the output file.
[mp4 @ 0x2dc98a0] Non-monotonous DTS in output stream 0:0; previous: 7163,
current: 7157; changing to 7164. This may result in incorrect timestamps in
the output file.
frame=  133 fps= 54 q=-1.0 size=     635kB time=00:00:05.03
bitrate=1032.3kbits/s
frame=  196 fps= 40 q=-1.0 size=    1077kB time=00:00:07.54
bitrate=1169.1kbits/s
[rtmp @ 0x2c01420] Sending bytes read report
frame=  265 fps= 35 q=-1.0 size=    1422kB time=00:00:10.34
bitrate=1126.3kbits/s
frame=  335 fps= 34 q=-1.0 size=    1771kB time=00:00:13.10
bitrate=1106.7kbits/s
frame=  389 fps= 31 q=-1.0 size=    2309kB time=00:00:15.25
bitrate=1239.8kbits/s
[rtmp @ 0x2c01420] Sending bytes read report
frame=  446 fps= 30 q=-1.0 size=    3049kB time=00:00:17.55
bitrate=1423.1kbits/s
[rtmp @ 0x2c01420] Sending bytes read report
frame=  512 fps= 30 q=-1.0 size=    3702kB time=00:00:20.21
bitrate=1500.1kbits/s
frame=  571 fps= 29 q=-1.0 size=    4089kB time=00:00:22.53
bitrate=1486.7kbits/s
frame=  644 fps= 29 q=-1.0 size=    4257kB time=00:00:25.49
bitrate=1368.0kbits/s
frame=  725 fps= 28 q=-1.0 size=    4464kB time=00:00:28.70
bitrate=1274.0kbits/s
frame=  782 fps= 28 q=-1.0 size=    4818kB time=00:00:30.97
bitrate=1274.4kbits/s
[rtmp @ 0x2c01420] Sending bytes read report
frame=  872 fps= 28 q=-1.0 size=    5010kB time=00:00:34.58
bitrate=1186.8kbits/s
frame=  918 fps= 28 q=-1.0 size=    5209kB time=00:00:36.43
bitrate=1171.1kbits/s


More information about the ffmpeg-user mailing list