I see it as a challenge.
Can have a countdown on a webpage within seconds, true.
But why not use the tech I have, and make it more interesting?
The only problem I’m facing at the moment is the actual streaming part.
I have an mp4, which plays fine on my PC with any media player, for the duration of 20 sec.
Created it using the following ffmpeg command:
ffmpeg -an -b 600000 -r 1 -i test%d.jpeg -vpre libx264-ultrafast -g 60 -f h264 -y -r 1 test.mp4
I used 20 jpegs and set the frame rate to 1 which produced the 20 sec. mp4 file.
Then I tried to stream it to Wowza with:
ffmpeg -vcodec h264 -an -b 600000 -r 1 -i test.mp4 -vpre libx264-ultrafast -g 60 -f flv -r 1 rtmp://localhost/live/countdown
Which the server accepts.
However, the ffmpeg is done right after I pressed the enter button.
Looks like it is Ignoring the fact that it should be 1 FPS.
Here is the output of ffmpeg:
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 27 2011 03:21:53 with gcc 4.4.5
configuration: --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-gpl --enable-libfaac --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libxvid --enable-version3
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
[h264 @ 0x16ba5d0] max_analyze_duration reached
[h264 @ 0x16ba5d0] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 2.00 (2/1) -> 1.00 (2/2)
Input #0, h264, from 'test.mp4':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 480x160 [PAR 1:1 DAR 3:1], 1 fps, 1 tbr, 1200k tbn, 2 tbc
[buffer @ 0x174aa50] w:480 h:160 pixfmt:yuv420p
Output #0, flv, to 'rtmp://localhost/live/countdown':
Metadata:
encoder : Lavf52.93.0
Stream #0.0: Video: flv, yuv420p, 480x160 [PAR 1:1 DAR 3:1], q=10-51, 600 kb/s, 1k tbn, 1 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 20 fps= 0 q=2.0 Lsize= 44kB time=20.00 bitrate= 18.2kbits/s
video:44kB audio:0kB global headers:0kB muxing overhead 1.220191%
Here is another try with output encoder set to h264:
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 27 2011 03:21:53 with gcc 4.4.5
configuration: --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-gpl --enable-libfaac --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libxvid --enable-version3
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
[h264 @ 0x2cf85d0] max_analyze_duration reached
[h264 @ 0x2cf85d0] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 2.00 (2/1) -> 1.00 (2/2)
Input #0, h264, from 'test.mp4':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 480x160 [PAR 1:1 DAR 3:1], 1 fps, 1 tbr, 1200k tbn, 2 tbc
[buffer @ 0x2d850b0] w:480 h:160 pixfmt:yuv420p
[libx264 @ 0x2cfa8c0] using SAR=1/1
[libx264 @ 0x2cfa8c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 0x2cfa8c0] profile Constrained Baseline, level 2.0
Output #0, h264, to 'rtmp://localhost/live/countdown':
Metadata:
encoder : Lavf52.93.0
Stream #0.0: Video: libx264, yuv420p, 480x160 [PAR 1:1 DAR 3:1], q=10-51, 600 kb/s, 90k tbn, 1 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 20 fps= 0 q=-1.0 Lsize= 26kB time=20.00 bitrate= 10.8kbits/s
video:26kB audio:0kB global headers:0kB muxing overhead 0.000000%
frame I:1 Avg QP:10.00 size: 11896
[libx264 @ 0x2cfa8c0] frame P:19 Avg QP:10.00 size: 800
[libx264 @ 0x2cfa8c0] mb I I16..4: 74.3% 0.0% 25.7%
[libx264 @ 0x2cfa8c0] mb P I16..4: 0.4% 0.0% 0.0% P16..4: 7.4% 0.0% 0.0% 0.0% 0.0% skip:92.2%
[libx264 @ 0x2cfa8c0] final ratefactor: -13.90
[libx264 @ 0x2cfa8c0] coded y,uvDC,uvAC intra: 28.5% 0.0% 0.0% inter: 4.2% 0.0% 0.0%
[libx264 @ 0x2cfa8c0] i16 v,h,dc,p: 70% 18% 12% 0%
[libx264 @ 0x2cfa8c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 38% 12% 2% 9% 3% 5% 2% 6%
[libx264 @ 0x2cfa8c0] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 @ 0x2cfa8c0] kb/s:10.84
Which also gives me the following errors in the server log:
INFO session connect-pending 127.0.0.1 -
INFO session connect 127.0.0.1 -
INFO stream create - -
INFO stream publish countdown -
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - AMFDataObj.deserialize[25:10]: java.nio.BufferUnderflowException
java.nio.BufferUnderflowException
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:127)
at java.nio.ByteBuffer.get(ByteBuffer.java:675)
at com.wowza.wms.amf.AMFDataObj.deserialize(Unknown Source)
at com.wowza.wms.amf.AMFDataObj.<init>(Unknown Source)
at com.wowza.wms.amf.AMFData.deserializeInnerObject(Unknown Source)
at com.wowza.wms.amf.AMFDataList.deserialize(Unknown Source)
at com.wowza.wms.amf.AMFDataList.<init>(Unknown Source)
at com.wowza.wms.request.RequestFunction.getMessage(Unknown Source)
at com.wowza.wms.request.RequestProcessFunctions.processFunctions(Unknown Source)
at com.wowza.wms.client.ClientWorker.processNextReq(Unknown Source)
at com.wowza.wms.request.RTMPRequestAdapter.service(Unknown Source)
at com.wowza.wms.server.ServerHandler.serviceRequest(Unknown Source)
at com.wowza.wms.server.ServerHandler.handleMessageReceived(Unknown Source)
at com.wowza.wms.server.ServerHandler.messageReceived(Unknown Source)
at com.wowza.wms.server.ServerHandlerThreadedSession.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
ERROR server comment - Zero sized function (client:1748301645:unknown): type:20 size:0:
INFO stream unpublish countdown -
INFO stream destroy countdown -
INFO session disconnect 1748301645 -
Anyone know how I can get ffmpeg to stream for the entire duration of the file, which should be 20 sec. ?