On 07/04/11 12:39, Alexandre Ferrieux wrote:
On 07/04/2011 13:14, David Pottage wrote:
Hello
I am attempting to transcode and re-stream a live TV channel using
ffmpeg under linux. My command line is:
ffmpeg -loglevel verbose \
-pix_fmt yuv422p -s 720x576 -i http://david-laptop:8000/4228 \
-vn -sn -acodec libfaac -ar 48000 -ab 64000 -ac 2 -async 1 -flags
+global_header -f rtp rtp://david-laptop:9022 \
-an -sn -vcodec libx264 -s 320x240 -fpre
resources/ffpreset/libx264-hq.ffpreset \
-fpre resources/ffpreset/libx264-ipod320.ffpreset -vglobal 1 -f rtp
rtp://david-laptop:9020 -newvideo
In the command line above, http://david-laptop:8000/4228 is connected to
a DVB capture card, and streams a raw DVB transport stream of a live TV
channel.
The outgoing stream is sent as two seperate elementary streams (audio
and video) over rtp.
My problem is that the streaming process is very unreliable. ffmpeg will
often hang on start-up, (before it emits the SDP file), or it will
start-up normally, but then crash after about a second of transcoding.
The reliablity appears to depend on the uptime of the machine, and the
number of times it has run before. It usually works if it is the first
time that ffmpeg is invoked after a reboot, but becomes less reliable
after that.
I have tried varying the network port numbers of the outgoing streams in
case something is not being cleaned up, but it does not make any
difference.
Has anyone experienced any symptoms like that. Can anyone suggest what
might be going on, or give me any clues for further investigation.
First, give the ffmpeg output (giving the version, detected container
and codec, stream mapping etc.).
Here:
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
built on Apr 4 2011 16:31:39 with gcc 4.4.3
configuration: --enable-postproc --extra-ldflags=-static
--extra-libs='-lvorbis -logg -lxvidcore -lx264 -lopencore-amrnb
-lopencore-amrwb -lfaad -lfaac -lm -lpthread' --enable-gpl
--enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libvorbis --enable-libx264
--enable-libxvid --enable-nonfree --enable-shared --enable-version3
--enable-libfaad --enable-small --disable-ffplay --disable-ffserver
--disable-doc
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[mpeg2video @ 0x9943990]mpeg_decode_postinit() failure
Last message repeated 13 times
[mpegts @ 0x993dae0]max_analyze_duration reached
[mpegts @ 0x993dae0]Estimating duration from bitrate, this may be
inaccurate
Input #0, mpegts, from 'http://10.10.10.10:8000/4228':
Duration: N/A, start: 55166.391433, bitrate: 15256 kb/s
Program 4228
Stream #0.0[0x262]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45
DAR 16:9], 15000 kb/s, 27.63 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x263](eng): Audio: mp2, 48000 Hz, 2 channels, s16,
256 kb/s
Stream #0.2[0x264](eng): Audio: mp3, 0 channels, s16
Stream #0.3[0x267](eng): Subtitle: dvbsub
Stream #0.4[0x26b]: Data: 0x0005
Stream #0.5[0x3f0]: Data: 0x000b
Stream #0.6[0x3f1]: Data: 0x000b
Stream #0.7[0x3f2]: Data: 0x000b
Stream #0.8[0x28a]: Data: 0x000b
Stream #0.9[0x28b]: Data: 0x000b
Stream #0.10[0x28c]: Data: 0x000b
[libx264 @ 0x99fe790]using SAR=4/3
[libx264 @ 0x99fe790]VBV buffer (3000) > level limit (2000)
[libx264 @ 0x99fe790]using cpu capabilities: MMX2 SSE2 SSE3 Cache64
[libx264 @ 0x99fe790]profile Constrained Baseline, level 1.3
[libx264 @ 0x99fe790]264 - core 114 r1913 5fd3dce - H.264/MPEG-4 AVC
codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html -
options: cabac=0 ref=4 deblock=1:0:0 analyse=0x1:0x111 me=umh subme=8
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1
bitrate=200 ratetol=20.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4
vbv_maxrate=768 vbv_bufsize=3000 nal_hrd=none ip_ratio=1.41 aq=1:1.00
When it is not working, ffmpeg usualy stops at that point and produces
no more output until I kill it with ^C
Sometimes it gets as far as emmiting the stream mappings & SDP file. I
then get:
Output #0, rtp, to 'rtp://david-laptop:8062':
Metadata:
encoder : Lavf52.64.2
Stream #0.0(eng): Audio: libfaac, 48000 Hz, 2 channels, s16, 64 kb/s
Output #1, rtp, to 'rtp://david-laptop:8060':
Metadata:
encoder : Lavf52.64.2
Stream #1.0: Video: libx264, yuv420p, 320x240 [PAR 4:3 DAR 16:9],
q=10-51, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #1.0
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 52.64.2
m=audio 8062 RTP/AVP 97
c=IN IP4 10.2.2.43
b=AS:64
a=rtpmap:97 MPEG4-GENERIC/48000/2
a=fmtp:97
profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;
config=1190
m=video 8060 RTP/AVP 96
c=IN IP4 10.2.2.43
b=AS:200
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;
sprop-parameter-sets=Z0LADdlBQfsOEAAAAwAQAAADAyDxQqWA,aMkjLIA=
Press [q] to stop encoding
[mpeg2video @ 0xa193990]warning: first frame is no keyframe
[mpeg2video @ 0xa193990]ac-tex damaged at 11 22=4.52 bitrate=
73.2kbits/s dup=12 drop=0
[mpeg2video @ 0xa193990]Warning MVs not available
[mpeg2video @ 0xa193990]concealing 630 DC, 630 AC, 630 MV errors
[mp2 @ 0xa1940f0]incomplete frame
Error while decoding stream #0.1
frame= 161 fps= 88 q=25.0 Lsize= 43kB time=5.48 bitrate=
64.3kbits/s dup=12 drop=0
video:70kB audio:43kB global headers:0kB muxing overhead -61.776752%
[libx264 @ 0xa1e8ac0]frame I:2 Avg QP:35.11 size: 1170
[libx264 @ 0xa1e8ac0]frame P:159 Avg QP:24.71 size: 430
[libx264 @ 0xa1e8ac0]mb I I16..4: 81.2% 0.0% 18.8%
[libx264 @ 0xa1e8ac0]mb P I16..4: 0.6% 0.0% 1.3% P16..4: 12.2%
2.3% 1.0% 0.0% 0.0% skip:82.5%
[libx264 @ 0xa1e8ac0]final ratefactor: 19.82
[libx264 @ 0xa1e8ac0]coded y,uvDC,uvAC intra: 43.6% 51.2% 36.3% inter:
3.6% 8.9% 1.7%
[libx264 @ 0xa1e8ac0]i16 v,h,dc,p: 55% 26% 3% 16%
[libx264 @ 0xa1e8ac0]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 21% 15% 6%
7% 9% 8% 7% 6%
[libx264 @ 0xa1e8ac0]i8c dc,h,v,p: 60% 23% 13% 4%
[libx264 @ 0xa1e8ac0]ref P L0: 79.4% 11.9% 6.7% 2.0%
[libx264 @ 0xa1e8ac0]kb/s:87.93
It only does transcoding for about a second before it stop working, and
quits.
Second, better characterize "crashes": open the corefile with gdb and
give the stack of every thread.
I should have been more clear. It is not crashing in the sense of a seg
fault and core dump. It is just stopping unexpectedly. There is no core
dump, it is just not producing anything useful.
Also, I'd try to decorrelate
depayloading/decoding/encoding/repayloading, and see which (if any)
crashes. To do so, use several ffmpeg processes connected by pipes,
and -[av]codec copy (and explicit -f values).
OK, I will try that. What container format do you recommend for the
pipes? In the past I have tried yuv4mpegpipe, but found it unstable as
it only works for video, not audio, so I used matroska. Is that a good
choice? Is there another container format that is good for raw streams.
--
David Pottage
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user