[FFmpeg-user] ffmpeg stalls when trying to transcode live content from HD PVR
ulf johansson
epkuson at gmail.com
Fri Feb 15 17:55:44 CET 2013
Hi,
I need some help with ffmpeg. I'm trying to configure ffmpeg to provide
live TV HLS streaming and transcoding to my Ipad in my home.
Project:
Objective to stream live TV (HD) transcoded to my IPAD both in my house and
using the 3G Data network.
Input:
Video source: Hauppauge HD PVR - analogue Component + OPTICAL => h264 AAC
mpegts
As soon as I'm trying to transcode the live TV stream it seems that the
ffmeg just stops or stalls. Please see 1) and 2) below.
1). Stream from hauppauge - transcode to ipad format with lower bitrate and
size - segment (HLS) streaming=> FFMPEG stalls!!
$ ffmpeg -i /dev/video0 -vcodec h264 -b:v 256k -s 320x240 -bsf
h264_mp4toannexb -flags -global_header -map 0 -f segment -segment_time 4
-segment_list test.m3u8 -segment_list_flags live -segment_list_size 10
-segment_format mpegts -acodec libmp3lame -ab 128k stream%05d.ts
ffmpeg version git-2013-02-12-7ff1a4b Copyright (c) 2000-2013 the FFmpeg
developers
built on Feb 11 2013 23:08:44 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264
--enable-nonfree --enable-version3
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 62.100 / 54. 62.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpegts @ 0x2b577c0] max_analyze_duration 5000000 reached at 5013333
microseconds
[mpegts @ 0x2b577c0] Estimating duration from bitrate, this may be
inaccurate
Input #0, mpegts, from '/dev/video0':
Duration: N/A, start: 0.387044, bitrate: 127 kb/s
Program 1
Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
fltp, 127 kb/s
[libx264 @ 0x2bbfb60] using SAR=4/3
[libx264 @ 0x2bbfb60] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.1 Cache64
[libx264 @ 0x2bbfb60] profile High, level 1.3
[segment @ 0x2b5cc80] Codec for stream 0 does not use global headers but
container format requires global headers
[segment @ 0x2b5cc80] Codec for stream 1 does not use global headers but
container format requires global headers
Output #0, segment, to 'stream%05d.ts':
Metadata:
encoder : Lavf54.62.100
Stream #0:0: Video: h264, yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=-1--1, 256
kb/s, 90k tbn, 29.97 tbc
Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (aac -> libmp3lame)
Press [q] to stop, [?] for help
frame= 155 fps= 60 q=29.0 size=N/A time=00:00:05.20 bitrate=N/A dup=1
drop=0
^C^C^CReceived signal 2: terminating
OBS!! After ~ 150 fps the box stop streaming, and ffmeg just stops and I
have to terminate it with multiple Ctrl Cs.
The segment file, (stream00000.ts) even if it does not contain a lot of
content it looks like properly transcoded content.
2). Stream from hauppauge - transcode to ipad format with lower bitrate and
size - store in mpegts file, =>ffmpeg/transcoding- stalls!!
$ ffmpeg -i /dev/video0 -vcodec h264 -b:v 256k -s 320x240 -bsf
h264_mp4toannexb -flags -global_header -map 0 -acodec libmp3lame -ab 128k
-f mpegts -y ~/Desktop/recorded_stream_transcoded.ts
ffmpeg version git-2013-02-12-7ff1a4b Copyright (c) 2000-2013 the FFmpeg
developers
built on Feb 11 2013 23:08:44 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264
--enable-nonfree --enable-version3
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 62.100 / 54. 62.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpegts @ 0x36ea2c0] max_analyze_duration 5000000 reached at 5013333
microseconds
[mpegts @ 0x36ea2c0] Estimating duration from bitrate, this may be
inaccurate
Input #0, mpegts, from '/dev/video0':
Duration: N/A, start: 0.387044, bitrate: 122 kb/s
Program 1
Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
fltp, 122 kb/s
[libx264 @ 0x36f01c0] using SAR=4/3
[libx264 @ 0x36f01c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.1 Cache64
[libx264 @ 0x36f01c0] profile High, level 1.3
Output #0, mpegts, to '/home/jocho/Desktop/recorded_stream_transcoded.ts':
Metadata:
encoder : Lavf54.62.100
Stream #0:0: Video: h264, yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=-1--1, 256
kb/s, 90k tbn, 29.97 tbc
Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (aac -> libmp3lame)
Press [q] to stop, [?] for help
frame= 165 fps= 54 q=31.0 size= 219kB time=00:00:05.52 bitrate=
324.7kbits/s dup=1 drop=0
Received signal 2: terminating
OBS!! After ~ 150 fps the box stop streaming, and ffmeg just stops and I
have to terminate it with multiple Ctrl Cs.
This time no segment file created.
3. If I break up the task, i.e. to record a file and then later transcode
the recorded file it is successful!
3.1 Record file in mpegts
$ ffmpeg -i /dev/video0 -vcodec copy -acodec copy -y
~/Desktop/recorded_stream.ts
ffmpeg version git-2013-02-12-7ff1a4b Copyright (c) 2000-2013 the FFmpeg
developers
built on Feb 11 2013 23:08:44 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264
--enable-nonfree --enable-version3
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 62.100 / 54. 62.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpegts @ 0x31b0020] max_analyze_duration 5000000 reached at 5013333
microseconds
[mpegts @ 0x31b0020] Estimating duration from bitrate, this may be
inaccurate
Input #0, mpegts, from '/dev/video0':
Duration: N/A, start: 0.387044, bitrate: 189 kb/s
Program 1
Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
fltp, 189 kb/s
Output #0, mpegts, to '/home/jocho/Desktop/recorded_stream.ts':
Metadata:
encoder : Lavf54.62.100
Stream #0:0: Video: h264 (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1
DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 189 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 6109 fps= 63 q=-1.0 Lsize= 89793kB time=00:01:41.97
bitrate=7213.5kbits/s
video:80929kB audio:1626kB subtitle:0 global headers:0kB muxing overhead
8.767737%
jocho at HTPC:/var/www/tv$
3.2). Transcode recording file to ipad format with lower bitrate and size -
segment (HLS) streaming- successful!!
$ ffmpeg -i ~/Desktop/recorded_stream.ts -vcodec h264 -b:v 1024k -s 320x240
-bsf h264_mp4toannexb -flags -global_header -map 0 -f segment -segment_time
4 -segment_list test.m3u8 -segment_list_flags live -segment_list_size 10
-segment_format mpegts -acodec libmp3lame -ab 128k stream%05d.ts
ffmpeg version git-2013-02-12-7ff1a4b Copyright (c) 2000-2013 the FFmpeg
developers
built on Feb 11 2013 23:08:44 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264
--enable-nonfree --enable-version3
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 62.100 / 54. 62.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpegts @ 0x32c97c0] max_analyze_duration 5000000 reached at 5003333
microseconds
Input #0, mpegts, from '/home/jocho/Desktop/recorded_stream.ts':
Duration: 00:01:42.02, start: 1.400000, bitrate: 7210 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
fltp, 135 kb/s
[libx264 @ 0x32d0100] using SAR=4/3
[libx264 @ 0x32d0100] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.1 Cache64
[libx264 @ 0x32d0100] profile High, level 2.0
[segment @ 0x32cf660] Codec for stream 0 does not use global headers but
container format requires global headers
[segment @ 0x32cf660] Codec for stream 1 does not use global headers but
container format requires global headers
Output #0, segment, to 'stream%05d.ts':
Metadata:
encoder : Lavf54.62.100
Stream #0:0: Video: h264, yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=-1--1,
1024 kb/s, 90k tbn, 29.97 tbc
Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (aac -> libmp3lame)
Press [q] to stop, [?] for help
frame= 3058 fps= 60 q=32766.0 Lsize=N/A time=00:01:41.97 bitrate=N/A dup=4
drop=0
video:12710kB audio:1594kB subtitle:0 global headers:0kB muxing overhead
-100.000150%
[libx264 @ 0x32d0100] frame I:82 Avg QP:11.29 size: 17961
[libx264 @ 0x32d0100] frame P:1248 Avg QP:13.38 size: 6984
[libx264 @ 0x32d0100] frame B:1728 Avg QP:14.50 size: 1636
[libx264 @ 0x32d0100] consecutive B-frames: 13.8% 29.7% 8.3% 48.1%
[libx264 @ 0x32d0100] mb I I16..4: 11.2% 45.3% 43.5%
[libx264 @ 0x32d0100] mb P I16..4: 4.1% 11.6% 7.0% P16..4: 27.6% 19.2%
16.7% 0.0% 0.0% skip:13.8%
[libx264 @ 0x32d0100] mb B I16..4: 0.4% 0.6% 0.5% B16..8: 23.3% 7.5% 3.9%
direct: 8.7% skip:55.0% L0:36.6% L1:42.0% BI:21.4%
[libx264 @ 0x32d0100] final ratefactor: 10.93
[libx264 @ 0x32d0100] 8x8 transform intra:49.2% inter:47.5%
[libx264 @ 0x32d0100] coded y,uvDC,uvAC intra: 84.2% 88.6% 81.8% inter:
31.0% 28.7% 15.6%
[libx264 @ 0x32d0100] i16 v,h,dc,p: 41% 40% 4% 15%
[libx264 @ 0x32d0100] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 17% 13% 5% 6% 9%
5% 10% 7%
[libx264 @ 0x32d0100] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 8% 5% 8% 10%
6% 9% 6%
[libx264 @ 0x32d0100] i8c dc,h,v,p: 44% 23% 23% 9%
[libx264 @ 0x32d0100] Weighted P-Frames: Y:7.7% UV:4.2%
[libx264 @ 0x32d0100] ref P L0: 67.5% 12.0% 14.3% 6.0% 0.3%
[libx264 @ 0x32d0100] ref B L0: 84.8% 13.6% 1.6%
[libx264 @ 0x32d0100] ref B L1: 96.3% 3.7%
[libx264 @ 0x32d0100] kb/s:1020.41
jocho at HTPC:/var/www/tv$
4. When not using any transcoding which result in approx >7 Mbit/s
bitrate... everything works like a charm.
ffmpeg -i /dev/video0 -c copy -map 0 -f segment -segment_time 4
-segment_list test.m3u8 -segment_list_flags live -segment_list_size 10
-segment_format mpegts -acodec libmp3lame -ab 128k stream%05d.ts
ffmpeg version git-2013-02-12-7ff1a4b Copyright (c) 2000-2013 the FFmpeg
developers
built on Feb 11 2013 23:08:44 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264
--enable-nonfree --enable-version3
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 62.100 / 54. 62.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mpegts @ 0x1c466c0] max_analyze_duration 5000000 reached at 5013333
microseconds
[mpegts @ 0x1c466c0] Estimating duration from bitrate, this may be
inaccurate
Input #0, mpegts, from '/dev/video0':
Duration: N/A, start: 0.387044, bitrate: 130 kb/s
Program 1
Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo,
fltp, 130 kb/s
Output #0, segment, to 'stream%05d.ts':
Metadata:
encoder : Lavf54.62.100
Stream #0:0: Video: h264 (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1
DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac -> libmp3lame)
Press [q] to stop, [?] for help
frame=15621 fps= 61 q=-1.0 Lsize=N/A time=00:04:20.64 bitrate=N/A
video:206825kB audio:4073kB subtitle:0 global headers:0kB muxing overhead
-100.000010%
Additional inf:
After enabling debug of Hauppage HDPVR driver, there is flow on-going until
it just stops (reading buffer)i.e. to me (novice) it indicate that FFMEG
stops reading the buffer!?! I believe the hauppauge is currently set to VBR
but this was all configured when I configured mythtv.
I've been searching for information for hours and I would truly appreciate
some help or guidance of what could be done to resolve this or what next
plan of action should be.
Best regards
uffe
More information about the ffmpeg-user
mailing list