[Libav-user] Live Streaming using libav

gaurav mishra gauravmishra.itbhu at gmail.com
Mon Oct 27 17:47:57 CET 2014


Hi All,
Now i am able to stream the video to my media server. But its playable only
using ffplay. Flash players or vlc are not able to play the stream. I am
assuming there is some problem with my encoding code which ffplay is able
to correct but other players are unable to do. in ffplay output i am seeing
couple of lines like

[h264 @ 0x7fc6ac80c000] no picture

which i do not see when i play a video encoded using flash or some other
tool.  Any ideas what might be wrong here ? following is complete output of
ffplay.

ffplay version N-66851-gd58fa94 Copyright (c) 2003-2014 the FFmpeg
developers

  built on Oct 22 2014 14:42:52 with Apple LLVM version 6.0
(clang-600.0.54) (based on LLVM 3.5svn)

  configuration: --enable-gpl --enable-libfdk-aac --enable-libx264
--enable-nonfree --enable-static --disable-shared

  libavutil      54. 10.100 / 54. 10.100

  libavcodec     56.  5.100 / 56.  5.100

  libavformat    56.  9.100 / 56.  9.100

  libavdevice    56.  1.100 / 56.  1.100

  libavfilter     5.  1.105 /  5.  1.105

  libswscale      3.  1.101 /  3.  1.101

  libswresample   1.  1.100 /  1.  1.100

  libpostproc    53.  3.100 / 53.  3.100

[rtmp @ 0x7fc6ab709fe0] Handshaking... vq=    0KB sq=    0B f=0/0

[rtmp @ 0x7fc6ab709fe0] Type answer 3

[rtmp @ 0x7fc6ab709fe0] Server version 3.0.1.1

[rtmp @ 0x7fc6ab709fe0] Proto = rtmp, path = /live/myStream, app = live,
fname = myStream

[rtmp @ 0x7fc6ab709fe0] Server bandwidth = 2500000

[rtmp @ 0x7fc6ab709fe0] Client bandwidth = 2500000

[rtmp @ 0x7fc6ab709fe0] New incoming chunk size = 4096

[rtmp @ 0x7fc6ab709fe0] Creating stream...

[rtmp @ 0x7fc6ab709fe0] Sending play command for 'myStream'

[flv @ 0x7fc6ad008800] Format flv probed with size=2048 and score=100

[flv @ 0x7fc6ad008800] Before avformat_find_stream_info() pos: 13 bytes
read:16536 seeks:0

[flv @ 0x7fc6ad008800] Stream discovered after head already parsed

*[h264 @ 0x7fc6ab823000] no picture*

[flv @ 0x7fc6ad008800] Negative cts, previous timestamps might be wrong.

[flv @ 0x7fc6ad008800] Invalid timestamps stream=0, pts=-71, dts=0, size=267

[flv @ 0x7fc6ad008800] Invalid timestamps stream=0, pts=-113, dts=0,
size=164

[flv @ 0x7fc6ad008800] Non-increasing DTS in stream 0: packet 2 with DTS 0,
packet 3 with DTS 0

[flv @ 0x7fc6ad008800] Invalid timestamps stream=0, pts=-29, dts=0, size=162

[flv @ 0x7fc6ad008800] Non-increasing DTS in stream 0: packet 3 with DTS 0,
packet 4 with DTS 0

[flv @ 0x7fc6ad008800] Non-increasing DTS in stream 0: packet 4 with DTS 0,
packet 5 with DTS 0

[flv @ 0x7fc6ad008800] Stream discovered after head already parsed

[flv @ 0x7fc6ad008800] All info found

rfps: 23.750000 0.014474

rfps: 23.833333 0.006451

    Last message repeated 1 times

rfps: 23.916667 0.001640

    Last message repeated 1 times

rfps: 24.000000 0.000043

    Last message repeated 1 times

rfps: 24.083333 0.001659

    Last message repeated 1 times

rfps: 24.166667 0.006488

rfps: 24.250000 0.014530

rfps: 47.750000 0.014576

rfps: 47.833333 0.006561

rfps: 47.916667 0.001761

rfps: 48.000000 0.000173

    Last message repeated 1 times

rfps: 48.083333 0.001798

    Last message repeated 1 times

rfps: 48.166667 0.006636

    Last message repeated 1 times

rfps: 48.250000 0.014687

rfps: 23.976024 0.000173

    Last message repeated 1 times

rfps: 47.952048 0.000694

[flv @ 0x7fc6ad008800] After avformat_find_stream_info() pos: 111114 bytes
read:111114 seeks:0 frames:125

Input #0, flv, from 'rtmp://localhost:1935/live/myStream':

  Metadata:

    encoder         : Lavf55.48.100

  Duration: 00:00:00.00, start: 0.000000, bitrate: N/A

    Stream #0:0, 46, 1/1000: Video: h264 (High), yuv420p(left), 424x240
(432x240), 1/96, 400 kb/s, 50 fps, 24 tbr, 1k tbn, 96 tbc

    Stream #0:1, 2, 1/1000: Data: none, 0/1

    Stream #0:2, 77, 1/1000: Audio: aac, 44100 Hz, stereo, fltp

detected 4 logical cores

[ffplay_abuffer @ 0x7fc6ab62ba80] Setting 'sample_rate' to value '44100'

[ffplay_abuffer @ 0x7fc6ab62ba80] Setting 'sample_fmt' to value 'fltp'

[ffplay_abuffer @ 0x7fc6ab62ba80] Setting 'channels' to value '2'

[ffplay_abuffer @ 0x7fc6ab62ba80] Setting 'time_base' to value '1/44100'

[ffplay_abuffer @ 0x7fc6ab62ba80] Setting 'channel_layout' to value '0x3'

[ffplay_abuffer @ 0x7fc6ab62ba80] tb:1/44100 samplefmt:fltp
samplerate:44100 chlayout:0x3

[ffplay_abuffersink @ 0x7fc6ab62bc40] auto-inserting filter 'auto-inserted
resampler 0' between the filter 'ffplay_abuffer' and the filter
'ffplay_abuffersink'

[AVFilterGraph @ 0x7fc6ab62b8e0] query_formats: 2 queried, 0 merged, 3
already done, 0 delayed

[auto-inserted resampler 0 @ 0x7fc6ab62c200] ch:2 chl:stereo fmt:fltp
r:44100Hz -> ch:2 chl:stereo fmt:s16 r:44100Hz

*[h264 @ 0x7fc6ac80c000] no picture *

*[h264 @ 0x7fc6ac852600] no picture *

Video frame changed from size:0x0 format:none serial:-1 to size:424x240
format:yuv420p serial:1

[ffplay_buffer @ 0x7fc6ab7144a0] Setting 'video_size' to value '424x240'

[ffplay_buffer @ 0x7fc6ab7144a0] Setting 'pix_fmt' to value '0'

[ffplay_buffer @ 0x7fc6ab7144a0] Setting 'time_base' to value '1/1000'

[ffplay_buffer @ 0x7fc6ab7144a0] Setting 'pixel_aspect' to value '0/1'

[ffplay_buffer @ 0x7fc6ab7144a0] Setting 'frame_rate' to value '24/1'

[ffplay_buffer @ 0x7fc6ab7144a0] w:424 h:240 pixfmt:yuv420p tb:1/1000
fr:24/1 sar:0/1 sws_param:

[ffplay_crop @ 0x7fc6ab7167e0] Setting 'out_w' to value 'floor(in_w/2)*2'

[ffplay_crop @ 0x7fc6ab7167e0] Setting 'out_h' to value 'floor(in_h/2)*2'

[AVFilterGraph @ 0x7fc6ab63c760] query_formats: 3 queried, 2 merged, 0
already done, 0 delayed

[ffplay_crop @ 0x7fc6ab7167e0] w:424 h:240 sar:0/1 -> w:424 h:240 sar:0/1

Audio frame changed from rate:44100 ch:2 fmt:fltp layout:stereo serial:-1
to rate:44100 ch:2 fmt:fltp layout:stereo serial:1

[ffplay_abuffer @ 0x7fc6ab449e20] Setting 'sample_rate' to value '44100'

[ffplay_abuffer @ 0x7fc6ab449e20] Setting 'sample_fmt' to value 'fltp'

[ffplay_abuffer @ 0x7fc6ab449e20] Setting 'channels' to value '2'

[ffplay_abuffer @ 0x7fc6ab449e20] Setting 'time_base' to value '1/44100'

[ffplay_abuffer @ 0x7fc6ab449e20] Setting 'channel_layout' to value '0x3'

[ffplay_abuffer @ 0x7fc6ab449e20] tb:1/44100 samplefmt:fltp
samplerate:44100 chlayout:0x3

[ffplay_abuffersink @ 0x7fc6ab449ec0] auto-inserting filter 'auto-inserted
resampler 0' between the filter 'ffplay_abuffer' and the filter
'ffplay_abuffersink'

[AVFilterGraph @ 0x7fc6ab449c80] query_formats: 2 queried, 0 merged, 3
already done, 0 delayed

[auto-inserted resampler 0 @ 0x7fc6ab44a400] ch:2 chl:stereo fmt:fltp
r:44100Hz -> ch:2 chl:stereo fmt:s16 r:44100Hz



On Mon, Oct 27, 2014 at 3:59 PM, gaurav mishra <gauravmishra.itbhu at gmail.com
> wrote:

> Hi All,
> I am trying to restream a incoming live stream using libav.
> equivalent of following command -
>
> ffmpeg -i rtmp://localhost:1935/vod/sample.mp4 -c:a aac -strict -2 -ar
> 44100 -c:v libx264 -f flv rtmp://localhost:1935/live/myStream
>
> I started with transcoding.c present in docs/examples .  The issue i am
> facing is i dont know how to handle stream which is of type
> AVMEDIA_TYPE_DATA.  The incoming live stream has 3 streams in it.
>  following is av_dump_format of incoming stream.
>
> *Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 424x240, 24.42
> fps, 24 tbr, 1k tbn, 48 tbc*
>
> *    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp*
>
> *    Stream #0:2: Data: none*
>
>
> when creating output streams i create video and audio streams according to
> my requirements but for 3rd stream when i am using avcodec_copy_context() ,
> i am getting a error -
>
> *Data codec 'none' for stream 2 is not compatible with FLV*
>
> when i tried to skip the third stream (ie create a output container with
> just audio and video stream) i am able to stream data to my media server.
> but flash players are not able to play the stream. ffplay was able to play
> the stream but it could not find audio stream. following is output of
> ffplay for my resultant stream-
>
> *Duration: 00:00:00.00, start: 0.000000, bitrate: N/A*
>
> *  Stream #0:0: Video: h264 (High), yuv420p, 424x240, 400 kb/s, 50 fps, 24
> tbr, 1k tbn, 96 tbc*
>
> *  Stream #0:1: Data: none*
>
> So i want to know what should i do with the 3rd stream(TYPE_DATA)  in
> input container.
>
> attached is my code.
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141027/c381f7c8/attachment.html>


More information about the Libav-user mailing list