[FFmpeg-user] Fwd: Transcode freezes within libavformat pthread_cond_timedwait

ZNET Subscriptions subscriptions at znet.ca
Thu Mar 10 15:40:31 CET 2016

Hello, just to close this question:

Ffmpeg 3.0 and pre-3.0 git versions will freeze as shown below on AMD 
FX(tm)-4170 Quad-Core Processor or AMD Phenom(tm) II X6 1090T Processor. 
Works as expected on Intel based mainboards - tested on HP DL380 G5 and 
HP DL360 G5 type servers.

Tanks, george.

-------- Original Message --------
Subject: [FFmpeg-user] Transcode freezes within libavformat 
Date: 2016-03-08 09:18
 From: ZNET Subscriptions <subscriptions at znet.ca>
To: ffmpeg-user at ffmpeg.org
Reply-To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>


Hit a condition where ffmpeg will freeze within 1-2 min. from start 
during transcode with libx264 or nvenc - it actually freezes in 
pthread_cond_timedwait() / udp_read() in libavformat. Just curious what 
it may be, ideas welcome. Examples below are with ffmpeg-3.0, but recent 
pulls from git give same condition.

Just to note that I that same stream udp:// is 
transcoded on different server - and that runs for several years with 
little problem - with an older ffmpeg, on HP DL360 G5 server, and this 
test is  on AMD mainboard with  AMD FX(tm)-4170 Quad-Core Processor.

--------------------- example is with nvenc, same with libx264 
ggeorgiev at gtx690:~/build/ffmpeg-3.0$ ./ffmpeg_g -i 
udp:// -y  -an -c:v nvenc -b:v 6M 
-f mpegts udp://
ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers
   built with gcc 4.9.2 (Debian 4.9.2-10)
   configuration: --prefix=/usr/local --enable-nvenc --enable-libfaac 
--enable-libfdk-aac --enable-librtmp --enable-libx264 --enable-gpl 
--enable-nonfree --enable-fontconfig --enable-libfreetype 
   libavutil      55. 17.103 / 55. 17.103
   libavcodec     57. 24.102 / 57. 24.102
   libavformat    57. 25.100 / 57. 25.100
   libavdevice    57.  0.101 / 57.  0.101
   libavfilter     6. 31.100 /  6. 31.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
   libpostproc    54.  0.100 / 54.  0.100
[mpeg2video @ 0x35bdfc0] Invalid frame dimensions 0x0.
     Last message repeated 13 times
Input #0, mpegts, from 'udp://':
   Duration: N/A, start: 858.765211, bitrate: 17776 kb/s
   Program 3
     Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), 
yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 17200 kb/s, 
59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
     Stream #0:1[0x34](fre): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
5.1(side), fltp, 384 kb/s (clean effects)
     Stream #0:2[0x35](frm): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
stereo, fltp, 192 kb/s (visual impaired)
Output #0, mpegts, to 'udp://':
     encoder         : Lavf57.25.100
     Stream #0:0: Video: h264 (nvenc) (Main), yuv420p, 1280x720 [SAR 1:1 
DAR 16:9], q=-1--1, 6000 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
       encoder         : Lavc57.24.102 nvenc
     Side data:
       unknown side data type 10 (24 bytes)
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (nvenc))
Press [q] to stop, [?] for help
frame=22864 fps= 60 q=-0.0 size=  287889kB time=00:06:20.96 
bitrate=6190.6kbits/s speed=1.01x
------------------------- after frame shown, it freezes 

------------------------- stack dump --------------------------
ggeorgiev at gtx690:~/build/ffmpeg-3.0$ gdb ffmpeg_g 1582
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
(gdb) where
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at 
#1  0x00000000006cb672 in udp_read (h=0x3599f20, buf=0x37a0180 "G", 
size=65536) at libavformat/udp.c:923
#2  0x00000000005d0aa3 in retry_transfer_wrapper (transfer_func=0x6cb5a0 
<udp_read>, size_min=1, size=65536, buf=0x37a0180 "G", h=0x3599f20)
     at libavformat/avio.c:392
#3  ffurl_read (h=0x3599f20, buf=0x37a0180 "G", size=65536) at 
#4  0x00000000005d5ec5 in fill_buffer (s=0x35ba3c0) at 
#5  avio_read (size=188, buf=0x7ffd28d9e830 "G", s=0x35ba3c0) at 
#6  ffio_read_indirect (s=s at entry=0x35ba3c0, 
buf=buf at entry=0x7ffd28d9e830 "G", size=size at entry=188, 
data=data at entry=0x7ffd28d9e828)
     at libavformat/aviobuf.c:610
#7  0x0000000000658dd7 in read_packet (s=s at entry=0x35996c0, 
buf=buf at entry=0x7ffd28d9e830 "G", raw_packet_size=188, 
data=data at entry=0x7ffd28d9e828)
     at libavformat/mpegts.c:2353
#8  0x0000000000659a61 in handle_packets (ts=ts at entry=0x35ca4c0, 
nb_packets=nb_packets at entry=0) at libavformat/mpegts.c:2422
#9  0x0000000000659b02 in mpegts_read_packet (s=<optimized out>, 
pkt=0x7ffd28d9eb20) at libavformat/mpegts.c:2658
#10 0x00000000006d006c in ff_read_packet (s=0x35996c0, 
pkt=0x7ffd28d9eb20) at libavformat/utils.c:697
#11 0x00000000006d33e0 in read_frame_internal (s=0x35996c0, 
pkt=0x7ffd28d9ef20) at libavformat/utils.c:1359
#12 0x00000000006d436a in av_read_frame (s=0x35996c0, 
pkt=0x7ffd28d9ef20) at libavformat/utils.c:1520
#13 0x0000000000497051 in get_input_packet (pkt=<optimized out>, 
f=<optimized out>) at ffmpeg.c:3644
#14 process_input (file_index=<optimized out>) at ffmpeg.c:3764
#15 transcode_step () at ffmpeg.c:4074
#16 transcode () at ffmpeg.c:4128
#17 0x000000000047a0a7 in main (argc=<optimized out>, 
argv=0x7ffd28d9f288) at ffmpeg.c:4319

Some ideas what may cause the problem? As told, same stream is 
transcoded in parallel on older ffpeg version, and it works. Could the 
computer type make the problem?

Any ideas appreciated,
Thanks, George.

ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

More information about the ffmpeg-user mailing list