I'm trying to make a simple "TV viewer" using a Linux DVB video capture card. Currently I watch TV using the following process (I'm on a Raspberry Pi):
- Tune to a channel using
azap -r TV_CHANNEL_HERE
. This will supply bytes to device/dev/dvb/adapter0/dvr0
. - Open OMXPlayer
omxplayer /dev/dvb/adapter0/dvr0
- Watch TV!
The problem comes when I try to change channels. Even if I set the player to cache incoming bytes (tried with MPlayer also), the player can't withstand a channel change (by restarting azap
with a new channel.
I'm thinking this is because of changes in the MPEG TS stream metadata.
Looking for a C library that would let me do the following:
- Pull cache_size * mpeg_ts_packet_size from DVR device.
- Evaluate each packet and rewrite metadata (PID, etc) as needed.
- Populate FIFO with resulting packet.
- Set {OMXPlayer,MPlayer} to read from FIFO.
The other thing I was thinking would be to use a program that converts MPEG TS into MPEG PS and concatenate the bytes that way.
Thoughts?
Indeed, when you want to tune on an other channel, some metadata can potentially change and invalid previously cached data. Unfortunately I'm not familiar with the tools you are using but your point
2.
makes me raise an eyebrow: you will waste your time trying to rewrite Transport Stream data.I would rather suggest to stop and restart process on zapping since it seems to work fine at start.
P.S.: Here are some tools that can help. Also, I'm not sure at which level your problem is but VLC can be installed on Raspberry PI and it handles TS gracefully.