Transcoding so that TvHeadend streams IPTV
Added by Bernard Mentink over 8 years ago
Hi,
I understand that to get tvheadend to output an IPTV compatible stream then it must be built with the --enable-libav ./configure option.
However when I do that I get an error regarding -fPIC when building ffmpeg... as so ..
gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64 -Wall -I. -I. -std=gnu99 -mpreferred-stack-boundary=5 -fomit-frame-pointer -fno-tree-vectorize -fPIC -c -o encoder/slicetype-cl.o encoder/slicetype-cl.c
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/const-a.o common/x86/const-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/cabac-a.o common/x86/cabac-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/dct-a.o common/x86/dct-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/deblock-a.o common/x86/deblock-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/mc-a.o common/x86/mc-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/mc-a2.o common/x86/mc-a2.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/pixel-a.o common/x86/pixel-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/predict-a.o common/x86/predict-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/quant-a.o common/x86/quant-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/cpu-a.o common/x86/cpu-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/dct-64.o common/x86/dct-64.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/bitstream-a.o common/x86/bitstream-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/sad-a.o common/x86/sad-a.asm
yasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f elf64 -Worphan-labels -DSTACK_ALIGNMENT=32 -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -o common/x86/trellis-64.o common/x86/trellis-64.asm
rm -f libx264.a
ar rc libx264.a common/mc.o common/predict.o common/pixel.o common/macroblock.o common/frame.o common/dct.o common/cpu.o common/cabac.o common/common.o common/osdep.o common/rectangle.o common/set.o common/quant.o common/deblock.o common/vlc.o common/mvpred.o common/bitstream.o encoder/analyse.o encoder/me.o encoder/ratecontrol.o encoder/set.o encoder/macroblock.o encoder/cabac.o encoder/cavlc.o encoder/encoder.o encoder/lookahead.o common/threadpool.o common/x86/mc-c.o common/x86/predict-c.o common/opencl.o encoder/slicetype-cl.o common/x86/const-a.o common/x86/cabac-a.o common/x86/dct-a.o common/x86/deblock-a.o common/x86/mc-a.o common/x86/mc-a2.o common/x86/pixel-a.o common/x86/predict-a.o common/x86/quant-a.o common/x86/cpu-a.o common/x86/dct-64.o common/x86/bitstream-a.o common/x86/sad-a.o common/x86/trellis-64.o
ranlib libx264.a
gcc -o x264 x264.o input/input.o input/timecode.o input/raw.o input/y4m.o output/raw.o output/matroska.o output/matroska_ebml.o output/flv.o output/flv_bytestream.o filters/filters.o filters/video/video.o filters/video/source.o filters/video/internal.o filters/video/resize.o filters/video/cache.o filters/video/fix_vfr_pts.o filters/video/select_every.o filters/video/crop.o filters/video/depth.o input/thread.o libx264.a -m64 -lm -lpthread -ldl
/usr/bin/ld: libx264.a(cabac-a.o): relocation R_X86_64_32 against `x264_cabac_range_lps' can not be used when making a shared object; recompile with -fPIC
libx264.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:204: recipe for target 'x264' failed
make[2]: *** [x264] Error 1
make[2]: Leaving directory '/home/bmentink/Builds/tvheadend/build.linux/ffmpeg/x264-snapshot-20160217-2245'
Makefile.ffmpeg:290: recipe for target '/home/bmentink/Builds/tvheadend/build.linux/ffmpeg/x264-snapshot-20160217-2245/.tvh_build' failed
make[1]: *** [/home/bmentink/Builds/tvheadend/build.linux/ffmpeg/x264-snapshot-20160217-2245/.tvh_build] Error 2
make[1]: Leaving directory '/home/bmentink/Builds/tvheadend'
Makefile:692: recipe for target '/home/bmentink/Builds/tvheadend/build.linux/ffmpeg/build/ffmpeg/lib/libavcodec.a' failed
make: *** [/home/bmentink/Builds/tvheadend/build.linux/ffmpeg/build/ffmpeg/lib/libavcodec.a] Error 2
I have tried putting the -fPIC option in the toplevel Makefile in the CFLAGS and the Makefile for ffmpeg, but no difference, same error. DOes the linker and/or the assembler need this option as well?
(as you can see from the top line the -fPIC option is present when compiling C files .. )
Thanks,
B
Replies (8)
RE: Transcoding so that TvHeadend streams IPTV - Added by Bernard Mentink over 8 years ago
It seems this might be an issue as well:
make -f Makefile.ffmpeg
make[1]: Entering directory '/home/bmentink/Builds/tvheadend'
DOWNLOAD https://dl.bintray.com/tvheadend/misc/staticlib//amd64/ffmpeg-2169ee4f65cc6fc502793dc947648255498d293d.tgz
--2016-03-03 09:27:08-- https://dl.bintray.com/tvheadend/misc/staticlib//amd64/ffmpeg-2169ee4f65cc6fc502793dc947648255498d293d.tgz
Resolving dl.bintray.com (dl.bintray.com)... 75.126.118.188, 108.168.243.150
Connecting to dl.bintray.com (dl.bintray.com)|75.126.118.188|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-03-03 09:27:09 ERROR 404: Not Found.
That source for that lib does not exist .... can someone please fix ....
RE: Transcoding so that TvHeadend streams IPTV - Added by Mark Clarkstone over 8 years ago
Bernard Mentink wrote:
It seems this might be an issue as well:
make -f Makefile.ffmpeg
make[1]: Entering directory '/home/bmentink/Builds/tvheadend'
DOWNLOAD https://dl.bintray.com/tvheadend/misc/staticlib//amd64/ffmpeg-2169ee4f65cc6fc502793dc947648255498d293d.tgz
--2016-03-03 09:27:08-- https://dl.bintray.com/tvheadend/misc/staticlib//amd64/ffmpeg-2169ee4f65cc6fc502793dc947648255498d293d.tgz
Resolving dl.bintray.com (dl.bintray.com)... 75.126.118.188, 108.168.243.150
Connecting to dl.bintray.com (dl.bintray.com)|75.126.118.188|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-03-03 09:27:09 ERROR 404: Not Found.
That source for that lib does not exist .... can someone please fix ....
This is because you haven't passed --disable-bintray_cache but even if you don't it should still build fine.
IPTV compatible stream then it must be built with the --enable-libav ./configure
I don't think you can use libav and ffmpeg together I believe it's one or the other, by default it builds static ffmpeg which should be able to output IPTV compatible streams.. Are you following some old tutorial?
RE: Transcoding so that TvHeadend streams IPTV - Added by Bernard Mentink over 8 years ago
Never mind, I found out how to do it:
I had to edit Makefile.ffmpeg and add the config option --enable-pic in two places.
It then built fine complete with transcode support .... will try it when I get home.
Yes, I was following a howto in this thread: .. about 1/2 way in .. and yes, it is a couple of years old I see ..
https://forums.plex.tv/discussion/comment/544372
But the need for -fPIC is a bug I feel, maybe it is needed for Atom processor target?
RE: Transcoding so that TvHeadend streams IPTV - Added by Bernard Mentink over 8 years ago
So I have this all working now, but I have no idea how I tell tvheadend to transcode my IPTV channels, so with the following URL:
#EXTINF:-1 tvg-id="5ead7218a1fb129f8391eea3da22a0cb",The Edge TV
http://localhost:9981/stream/channelid/410168670?ticket=BCDABA77C54B2790F94C8166A38AE924384F2B9D&profile=pass
It looks like it is using the "pass" profile, do I simply tell it to use another profile?
Is transcoding documented somewhere? I can't find it ..
RE: Transcoding so that TvHeadend streams IPTV - Added by Bengt Madeberg over 8 years ago
1) Set up a streaming profile in the "stream" tab.
2) Assign a new user in the "users" tab and set the streaming profile you just did.
3) Start the streaming with http://user:password@server:9981/.....
Done
RE: Transcoding so that TvHeadend streams IPTV - Added by Bernard Mentink over 8 years ago
Thanks, but not quite getting it.
So in my example stream above do I do:
http://user:password@localhost:9981/stream/channelid/410168670?ticket=BCDABA77C54B2790F94C8166A38AE924384F2B9D&profile=pass
.. and change "pass" to whatever profile I have supported for that user?
Cheers,
RE: Transcoding so that TvHeadend streams IPTV - Added by Mark Clarkstone over 8 years ago
Bernard Mentink wrote:
Thanks, but not quite getting it.
So in my example stream above do I do:
http://user:password@localhost:9981/stream/channelid/410168670?ticket=BCDABA77C54B2790F94C8166A38AE924384F2B9D&profile=pass
.. and change "pass" to whatever profile I have supported for that user?Cheers,
If you set a stream profile for a user (in the Access Entries tab) it will use that by default (you won't need to define it in the URL if you pick just one (You will if you select two or more) ), if you don't set it tvheadend will use whatever stream profile is default in Config -> Stream -> Stream Profiles.
RE: Transcoding so that TvHeadend streams IPTV - Added by Bernard Mentink over 8 years ago
Thanks for that, tested and working.
I am feeding tvheadend iptv streams into Plex via a plugin and having issues with HD channels pausing/dropping frames, I thought transcoding might help, but it doesn't.
It seems I have some sort of buffereing issue between Tvheadend and Plex. Tvheadend streams 1080p fine to mpv player and Plex plays 1080p videos and 1080p streams on the net, just not tvheadends ..
At a loss on how to fix this, is there any buffer settings I can play with?