What about copy stream I mean mpeg2 to be mpeg2 and so on. I think this is the last chance. Another option is to put everything on restreaming pc or using hardware decoding of rpi or similar and control it from OnlineTV app. Something like sending post request on play which will send the URL for transcoding and get a response with URL for playing. When we switch the channel sending a signal stop transcoding, or sending ping signals frequently if there is timeout the transcoding will be stopped on server side. I think we can do server side easily with python or nodejs
EDIT:
After some experimenting I have optimised ffmpeg options at least for SD channels with average bitrate.
I am using usb drive to store temporary files
Code: Select all
/mtd_rwcommon/ffmpeg -i "http://stream" -segment_list /dtv/usb/sda1/HLS/playlist.m3u8 -segment_list_type hls -flags -global_header -f segment -segment_format mpeg_ts -segment_time 10 -segment_list_size 10 -segment_list_flags +live -segment_wrap 20 -filter_complex [0:v][0:s]overlay -c:v libx264 -preset ultrafast -tune zerolatency -profile baseline -bsf:v h264_mp4toannexb -c:a copy /dtv/usb/sda1/HLS/out%03d.ts
With little bit magic and a lot of reading no glitching at all
Code: Select all
/mtd_rwcommon/ffmpeg -i "http://steam" -segment_list /dtv/usb/sda1/HLS/playlist.m3u8 -segment_list_type hls -flags -global_header -f ssegment -segment_format mpeg_ts -segment_time 10 -segmen
t_list_size 10 -segment_list_flags +live -segment_wrap 20 -filter_complex [0:v][0:s]overlay -preset ultrafast -vcodec mpeg2video -b 6000k -minrate 6000k -maxrate 6000k -bufsize 8Mi -threads 0 -acodec copy /dtv/usb/sda1/HLS/out%03d.ts
frame= 6421 fps= 26 q=2.0 size=N/A time=00:04:16.72 bitrate=N/A dup=30 drop=0 speed=1.02x