[FFmpeg-user] ffmpeg, ffserver, libx264 and mpegts configuration

Mladen Radev mladen at intelvision.sc
Tue Feb 25 12:39:19 CET 2014


Hi,
I try from several days to reencode mpeg2 ts with libx264 (for save
bandwidth), to send to another machine by tcp protocol and use in same
streamer (proprietary).

ffserver configuration

<Stream live1.ts>

    format flv
    feed feed2.ffm

    VideoCodec libx264
    VideoFrameRate 25
    VideoBitRate 1500
    VideoBitRateRange 1200-2000
    VideoSize 720x576
    VideoBufferSize 5120k
   AVOptionVideo flags +global_header
   AVOptionVideo qmin 10
   AVOptionVideo qmax 51
   AVOptionVideo fps 25

    AudioCodec aac
    AudioBitRate 128k
    AudioChannels 2
    AudioSampleRate 48000
    AVOptionAudio flags +global_header

</Stream>

<Stream live2.ts>

    format flv
    feed feed2.ffm

    VideoCodec libx264
    VideoFrameRate 25
    VideoBitRate 1500
    VideoBitRateRange 1200-2000
    VideoSize 720x576
    VideoBufferSize 5120k
    AVOptionVideo flags +global_header
    AVOptionVideo qmin 10
    AVOptionVideo qmax 51
    AVOptionVideo fps 25

    AudioCodec aac
    AudioBitRate 128k
    AudioChannels 2
    AudioSampleRate 48000
    AVOptionAudio flags +global_header

</Stream>

streamer command:

ffmpeg -v verbose -i
'udp://@10.12.43.254:56789?fifo_size=10000000&overrun_nonfatal=1' -map
p:36 -acodec aac -ac 2 -b:a 64k -r:a 44100 -strict -2 -async 1 -vcodec
libx264 -b:v 1500k -s 720x576 -threads 0 -r:v 25 -g 45 -flags
global_header -c:s copy -f ffm 'http://192.168.1.241:8090/feed2.ffm

Result:

mladen at mladen:~ > ffprobe -v debug 'http://192.168.1.241:8090/live1.ts'
ffprobe version N-60762-g3edc3b1 Copyright (c) 2007-2014 the FFmpeg
developers
  built on Feb 20 2014 13:54:29 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --extra-libs=-ldl --enable-gpl --enable-libmp3lame
--enable-libvpx --enable-libx264 --enable-nonfree --enable-libx265
  libavutil      52. 65.100 / 52. 65.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  1.103 /  4.  1.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0x393dd00] request: GET /live1.ts HTTP/1.1
User-Agent:
Lavf/55.33.100                                                                                                                                                                     

Accept:
*/*                                                                                                                                                                                    

Range:
bytes=0-                                                                                                                                                                                

Connection:
close                                                                                                                                                                              

Host:
192.168.1.241:8090                                                                                                                                                                       



[http @ 0x393dd00] header='HTTP/1.0 200
OK'                                                                                                                                                    

[http @ 0x393dd00]
http_code=200                                                                                                                                                               

[http @ 0x393dd00] header='Pragma:
no-cache'                                                                                                                                                   

[http @ 0x393dd00] header='Content-Type:
video/x-flv'                                                                                                                                          

[http @ 0x393dd00]
header=''                                                                                                                                                                   

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

[flv @ 0x393d660] Before avformat_find_stream_info() pos: 13 bytes
read:3658
seeks:0                                                                                                           

[h264 @ 0x393fba0] Frame num gap 11
9                                                                                                                                                          

[flv @ 0x393d660] All info
found                                                                                                                                                               

[flv @ 0x393d660] After avformat_find_stream_info() pos: 228441 bytes
read:228638 seeks:0
frames:118                                                                                           

Input #0, flv, from 'http://192.168.1.241:8090/live1.ts':
  Metadata:
    encoder         : Lavf55.33.100
  Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
    Stream #0:0, 41, 1/1000: Video: h264 (High), yuv420p, 720x576 [SAR
16:15 DAR 4:3], 1/50, 1500 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0:1, 77, 1/1000: Audio: aac, 48000 Hz, stereo, fltp, 64 kb/s
detected 4 logical cores
[AVIOContext @ 0x39477e0] Statistics: 228638 bytes read, 0
seeks                                                                                                                               

mladen at mladen:~ > ffprobe -v debug 'http://192.168.1.241:8090/live2.ts'
ffprobe version N-60762-g3edc3b1 Copyright (c) 2007-2014 the FFmpeg
developers
  built on Feb 20 2014 13:54:29 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --extra-libs=-ldl --enable-gpl --enable-libmp3lame
--enable-libvpx --enable-libx264 --enable-nonfree --enable-libx265
  libavutil      52. 65.100 / 52. 65.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  1.103 /  4.  1.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0x2138d00] request: GET /live2.ts HTTP/1.1
User-Agent:
Lavf/55.33.100                                                                                                                                                                     

Accept:
*/*                                                                                                                                                                                    

Range:
bytes=0-                                                                                                                                                                                

Connection:
close                                                                                                                                                                              

Host:
192.168.1.241:8090                                                                                                                                                                       



[http @ 0x2138d00] header='HTTP/1.0 200
OK'                                                                                                                                                    

[http @ 0x2138d00]
http_code=200                                                                                                                                                               

[http @ 0x2138d00] header='Pragma:
no-cache'                                                                                                                                                   

[http @ 0x2138d00] header='Content-Type:
video/x-mpegts'                                                                                                                                       

[http @ 0x2138d00]
header=''                                                                                                                                                                   

[mpegts @ 0x2138660] Format mpegts probed with size=2048 and
score=100                                                                                                                         

[mpegts @ 0x2138660] stream=0 stream_type=f pid=100
prog_reg_desc=                                                                                                                             

[mpegts @ 0x2138660] stream=1 stream_type=1b pid=101
prog_reg_desc=                                                                                                                            

[mpegts @ 0x2138660] Before avformat_find_stream_info() pos: 0 bytes
read:8724
seeks:0                                                                                                         

[mpegts @ 0x2138660] All programs have pmt, headers
found                                                                                                                                      

[h264 @ 0x2146e00] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x2146e00] decode_slice_header error
[h264 @ 0x2146e00] no frame!
[h264 @ 0x2146e00] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x2146e00] decode_slice_header error
[h264 @ 0x2146e00] no frame!
-------- CUT LONG LIST -----------
[h264 @ 0x2146e00] decode_slice_header error
[h264 @ 0x2146e00] no frame!
[mpegts @ 0x2138660] max_analyze_duration 5000000 reached at 5013333
microseconds
[mpegts @ 0x2138660] decoding for stream 1 failed
[mpegts @ 0x2138660] Could not find codec parameters for stream 1
(Video: h264 ([27][0][0][0] / 0x001B)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
[mpegts @ 0x2138660] After avformat_find_stream_info() pos: 1009748
bytes read:1009748 seeks:0 frames:387
Input #0, mpegts, from 'http://192.168.1.241:8090/live2.ts':
  Duration: N/A, start: 40650.598933, bitrate: 71 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 251, 1/90000: Audio: aac ([15][0][0][0] /
0x000F), 48000 Hz, stereo, fltp, 71 kb/s
    Stream #0:1[0x101], 136, 1/90000: Video: h264 ([27][0][0][0] /
0x001B), 90k tbr, 90k tbn, 180k tbc
detected 4 logical cores
[AVIOContext @ 0x21427e0] Statistics: 1009748 bytes read, 0 seeks
mladen at mladen:~ >

Question is: How to tell to mpegts muxer from ffserver config to stream
correct video pid info (size, rate, etc.)?
I need this, because restreamers that is used in network not understand
FLV container. They want mpegts.

Thanks

-- 
Regards,

Mladen Radev
IT System/Network Engineer
Intelvision Ltd.

mobile +248 2813135
office +248 4414296
www.intelvision.net
mladen at intelvision.sc

Think of the environment! Please, don't print this e-mail unless you really need to.



More information about the ffmpeg-user mailing list