Forums » Tutorial and setups »
PiP two channels with interchangeable audios
Added by Dimitar Maznekov over 5 years ago
1. Create file for exmpl /home/hts/.hts/tvheadend/scripts/pip with next code:
version with channel numbers
#!/bin/bash ffmpeg -loglevel fatal -thread_queue_size 512 -i http://127.0.0.1:9981/stream/channelnumber/$1 -thread_queue_size 512 -i http://127.0.0.1:9981/stream/channelnumber/$2 -filter_complex "[1]scale=iw/3:ih/3 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10[v]" -map "[v]" -map 0:1 -map 1:1 -metadata:s:a:0 language=bul -metadata:s:a:1 language=eng -strict -2 -ac 2 -ar 44100 -vcodec libx264 -q:v 5 -crf 5 -r 25 -acodec aac -metadata service_provider=PiP -metadata service_name=PiP -tune zerolatency -f mpegts pipe:1
version with channelID
#!/bin/bash ffmpeg -loglevel fatal -thread_queue_size 512 -i http://127.0.0.1:9981/stream//id//$1 -thread_queue_size 512 -i http://127.0.0.1:9981/stream//id//$2 -filter_complex "[1]scale=iw/3:ih/3 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10[v]" -map "[v]" -map 0:1 -map 1:1 -metadata:s:a:0 language=bul -metadata:s:a:1 language=eng -strict -2 -ac 2 -ar 44100 -vcodec libx264 -q:v 5 -crf 5 -r 25 -acodec aac -metadata service_provider=PiP -metadata service_name=PiP -tune zerolatency -f mpegts pipe:1
NOTE: that's onliners keep in mind !
2. Add MUX, URL field:
pipe:////home/hts/.hts/tvheadend/scripts/pip 102 103
or
pipe:////home/hts/.hts/tvheadend/scripts/pip BBC NBS
First channel number/id is main (on full screen) second is in small window.
IMPORTANT: Mark Respawn option
3. Map MUX as service and vice versa
That way connection to two channels will be open only when the PiP channel is requested (not unnecessary provider connections)
OPTIONAL: If you want to make audio interchangeable in KODI could made it by Keyboard.xml
<!-- PVR windows --> <e>ActivateWindow(TVGuide)</e> <h>ActivateWindow(TVChannels)</h> <j>ActivateWindow(RadioChannels)</j> <k>ActivateWindow(TVRecordings)</k> <b>ActivateWindow(TVTimers)</b> <l>AudioNextLanguage</l>
That way you could switch languages with key L
Replies (1)
RE: PiP two channels with interchangeable audios - Added by Dimitar Maznekov over 4 years ago
Glad you found it usefull.