0

The Problem
Recording TV shows from HDHomerun Prime results in either 30 seconds of clean video, then a loud beep and loss of roughly 1/2 a second or results in a stream that looks like it was recorded from OTA TV with a really bad signal (ie: I get maybe two or three good frames per second of video and it's completely unwatchable). Please help me get this working, as I am never home at these times to watch my favorite shows.

Network Setup
I have a TP-Link TL-SG1016D (gigabit) with a Cat5E cable going to my HDHomerun Prime (which has a DHCP reserved IP)
Also hooked into my TP-link switch are:
Netgear WNDR-4500 (via Cat5E) for internet access and DHCP server
Poweredge 1950 (via two Cat5E cables) running ESXi 5.1u1 with an arch linux VM for recording
Older custom Intel desktop (via Cat5E plugged into the Netgear WNDR-4500) with a high-end Core 2 Duo, gigabit ethernet running arch linux for recording

Software Setup
Both of the arch linux systems have the cronie service enabled and have curl installed

Here is my crontab:

#Agents of SHIELD
0 20 * * 2 /home/user/cron/RECORD-ch-name-time.sh 707 "Marvel's Agents of SHIELD - 1x02.mpg" 3600
#House
0 21 * * 2 /home/user/cron/RECORD-ch-name-time.sh 704 "House - 4x12-13.mpg" 7200
#Person of Interest
0 22 * * 2 /home/user/cron/RECORD-ch-name-time.sh 705 "Person of Interest - 3x02.mpg" 3600
#Arrow
0 20 * * 3 /home/user/cron/RECORD-ch-name-time.sh 712 "Arrow - 2x01.mpg" 3600

Here is the bash file it is calling:

#!/bin/bash

CHANNEL=707
FILENAME="output"
TIMEOUTSECS=3720

# Set channel
if [ "$1" ]
    then
        CHANNEL="$1"
fi

# Set filename
if [ "$2" ]
    then
        FILENAME="$2"
fi

# Set timeout time in minutes
if [ "$3" ]
    then
        TIMEOUTSECS="$3"
fi

# Start recording
cd /home/user/recordings
echo curl http://192.168.1.200:5004/auto/v$CHANNEL -m $TIMEOUTSECS>> "v$CHANNEL"
curl http://192.168.1.200:5004/auto/v$CHANNEL -m $TIMEOUTSECS>> "v$CHANNEL"
echo "Renaming output_file in RECORD-ch-name-time.sh"
mv "v$CHANNEL" "$FILENAME"
cd /home/user/cron
echo "End of RECORD-ch-name-time.sh"
KG6ZVP
  • 111
  • 6

1 Answers1

0

The problem was with caching and with using an http download program and stdout to write to a file. If anyone has any ideas as to why my solution works and my original effort did not, please comment!

This is what I did:
-My Crontab looks the same
-My recording script uses mplayer and caches the media to memory as it writes to a file
-I checked the write speed of the hard disk I was using and I consistently get sustained contiguous writes of betwen 74-76MB/s

Here's my script: #!/bin/bash

CHANNEL=707
FILENAME="output"
TIMEOUTSECS=3601

# Set channel
if [ "$1" ]
    then
        CHANNEL="$1"
fi

# Set filename
if [ "$2" ]
    then
        FILENAME="$2"
fi

# Set timeout time in minutes
if [ "$3" ]
    then
        TIMEOUTSECS="$3"
fi

echo $0 $CHANNEL $FILENAME $TIMEOUTSECS> "/home/user/cron/log/log-RECORD.sh $CHANNEL $FILENAME $TIMEOUTSECS.txt"

# Start recording
cd /home/user/recordings
echo RECORDING>> "/home/user/recordings/$FILENAME.LOCK.mkv"
echo mplayer -cache 131072 -dumpfile "/home/user/recordings/$FILENAME.mpg" -dumpstream "http://192.168.1.200:5004/auto/v$CHANNEL"

/usr/bin/mplayer -cache 196608 -dumpfile "/home/user/recordings/$FILENAME.mpg" -dumpstream "http://192.168.1.200:5004/auto/v$CHANNEL"&
sleep $TIMEOUTSECS
sleep 1
for s in HUP INT KILL; do
    kill -$s $! &>/dev/null || break
    sleep 5
done

rm "/home/user/recordings/$FILENAME.LOCK.mkv"

/usr/bin/ccextractor "/home/user/recordings/$FILENAME.mpg" -out=srt -o "/home/user/recordings/$FILENAME.srt"
/usr/bin/ffmpeg -i "/home/user/recordings/$FILENAME.mpg" -i "/home/user/recordings/$FILENAME.srt" -scodec copy -vcodec copy -threads 8 -acodec copy "/home/user/recordings/$FILENAME-Editable.mpg"

/usr/bin/ffmpeg -i "/home/user/recordings/$FILENAME.srt" -i "/home/user/recordings/$FILENAME-Editable.mkv" -scodec copy -vcodec libx264 -threads 8 -crf 26 -coder 1 -acodec aac -vbr 4 -strict -2 "/home/user/recordings/$FILENAME-Quick.mkv"

chown -R user "/home/user/recordings/*"

cd /home/user/cron
KG6ZVP
  • 111
  • 6