8.4 KiB
Raspberry Pi Video Player Auto-Start System
A comprehensive video player system for Raspberry Pi that automatically starts on boot and provides TV-like channel navigation with IR remote control support.
Features
- Auto-Start on Boot: Automatically starts when Raspberry Pi boots
- VLC Integration: Uses VLC media player for robust video playback
- IR Remote Control: Full IR remote support with multiple protocol decoding (NEC, RC5)
- TV Channel System: Number key mapping to videos (0-9, multi-digit support)
- Configuration Management: Comprehensive configuration system with validation
- Systemd Service: Reliable service management with auto-restart
- Logging: Detailed logging with rotation
- Easy Setup: Interactive setup wizard and installation scripts
Hardware Requirements
Required
- Raspberry Pi (any model with sufficient processing power)
- MicroSD card (minimum 16GB, Class 10 recommended)
- Power supply (official Raspberry Pi power adapter recommended)
- HDMI cable for display output
- IR Receiver Module: Compatible with Raspberry Pi GPIO (e.g., TSOP4838, TSOP38238)
- IR Remote Control: Any standard IR remote (TV, DVD player, etc.)
Optional
- External storage for video files
- Case with cooling for extended operation
Software Requirements
- Operating System: Raspbian Desktop (latest version)
- Python: Python 3.x (usually pre-installed on Raspbian)
- VLC Media Player: Latest version compatible with Raspbian
- System Dependencies: Standard Linux utilities for service management
Installation
Quick Installation
-
Clone the repository:
git clone https://github.com/your-repo/ulivision-tv.git cd ulivision-tv -
Run the installation script:
sudo chmod +x install.sh sudo ./install.sh -
Run the setup wizard:
sudo python3 setup.py -
Start the service:
video-player-start
Manual Installation
-
Install system dependencies:
sudo apt-get update sudo apt-get install -y python3 python3-pip vlc python3-rpi.gpio -
Install Python dependencies:
pip3 install -r requirements.txt -
Copy files to system directories:
sudo mkdir -p /opt/video_player /etc/video_player sudo cp *.py /opt/video_player/ sudo cp video-player.service /etc/systemd/system/ -
Enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable video-player sudo systemctl start video-player
Configuration
Main Configuration
The main configuration is stored in /etc/video_player/config.json:
{
"video_folder": "/home/pi/Videos",
"default_channel": 1,
"auto_play": true,
"fullscreen": true,
"ir_pin": 18,
"ir_protocols": ["NEC", "RC5"],
"vlc_options": [
"--fullscreen",
"--no-video-title-show",
"--no-audio-display"
],
"log_level": "INFO"
}
Channel Configuration
Channels are configured in /etc/video_player/channels.json:
{
"1": {
"number": 1,
"name": "Sample Video 1",
"path": "/home/pi/Videos/sample1.mp4",
"description": "First sample video",
"category": "general",
"enabled": true,
"priority": 0
}
}
IR Remote Mapping
IR codes are mapped in /etc/video_player/ir_mapping.json:
{
"NEC_00FF_807F": {
"ir_code": "NEC_00FF_807F",
"command": "channel_0",
"description": "Channel 0",
"repeatable": true
}
}
Usage
Basic Operation
- Add video files to the configured video folder (default:
/home/pi/Videos) - Configure channels using the setup wizard or manually edit the channels.json file
- Map IR remote codes using the IR learning mode or manually edit the mapping file
- Start the service and use your IR remote to control playback
IR Remote Commands
- Number keys (0-9): Direct channel access
- Multi-digit channels: Enter channel number (e.g., 12, 25)
- Play/Pause: Toggle playback
- Stop: Stop current video
- Next/Previous: Navigate between channels
- Volume Up/Down: Control audio volume
- Power: Exit application
Management Commands
video-player-start: Start the servicevideo-player-stop: Stop the servicevideo-player-restart: Restart the servicevideo-player-status: Check service statusvideo-player-logs: View live logs
IR Remote Setup
Learning IR Codes
-
Start IR learning mode:
sudo /opt/video_player/venv/bin/python /opt/video_player/ir_remote.py -
Press buttons on your remote control
-
Enter commands when prompted (e.g., "channel_1", "play_pause")
-
Save mappings to the configuration file
Manual IR Code Mapping
Edit /etc/video_player/ir_mapping.json to manually map IR codes:
{
"NEC_00FF_807F": {
"ir_code": "NEC_00FF_807F",
"command": "channel_0",
"description": "Channel 0",
"repeatable": true
}
}
Hardware Setup
IR Receiver Connection
-
Connect IR receiver to Raspberry Pi GPIO:
- VCC → 3.3V (Pin 1)
- GND → Ground (Pin 6)
- OUT → GPIO 18 (Pin 12) - or configure different pin
-
Test IR receiver:
sudo python3 -c "import RPi.GPIO as GPIO; GPIO.setmode(GPIO.BCM); GPIO.setup(18, GPIO.IN); print('GPIO 18 ready')"
GPIO Pin Configuration
The IR receiver GPIO pin can be configured in the main configuration file:
{
"ir_pin": 18
}
Troubleshooting
Common Issues
-
Service won't start:
- Check logs:
video-player-logs - Verify configuration:
sudo python3 setup.py - Check file permissions
- Check logs:
-
IR remote not working:
- Verify GPIO pin configuration
- Check IR receiver connections
- Test with IR learning mode
- Verify IR code mappings
-
Videos not playing:
- Check video file formats (supported: MP4, AVI, MKV, MOV, WMV, FLV, WebM, M4V)
- Verify file paths in channels.json
- Check VLC installation:
vlc --version
-
No audio:
- Check audio device configuration
- Verify volume settings
- Test audio:
speaker-test -t wav -c 2
Log Files
- Service logs:
journalctl -u video-player -f - Application logs:
/var/log/video_player.log - System logs:
/var/log/syslog
Debug Mode
Enable debug logging by setting log level to DEBUG in the configuration:
{
"log_level": "DEBUG"
}
Development
Project Structure
ulivision-tv/
├── video_player.py # Main video player application
├── ir_remote.py # IR remote control system
├── config_manager.py # Configuration management
├── setup.py # Interactive setup wizard
├── install.sh # Installation script
├── uninstall.sh # Uninstallation script
├── video-player.service # Systemd service file
├── requirements.txt # Python dependencies
└── README.md # This file
Adding New Features
- Fork the repository
- Create a feature branch
- Implement your changes
- Add tests (if applicable)
- Submit a pull request
Testing
Run the test suite:
python3 -m pytest tests/
Uninstallation
To completely remove the video player system:
sudo ./uninstall.sh
This will remove:
- Application files
- Configuration files
- Service configuration
- Management scripts
- Desktop shortcuts
- Log files
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
For support and questions:
- Issues: Create an issue on GitHub
- Documentation: Check the wiki
- Community: Join our Discord server
Changelog
Version 1.0.0
- Initial release
- VLC integration
- IR remote control
- TV channel system
- Systemd service
- Configuration management
- Setup wizard
Acknowledgments
- VLC Media Player team for the excellent media player
- Raspberry Pi Foundation for the amazing hardware
- Python community for the great libraries
- Contributors and testers
Note: This system is designed for educational and personal use. Ensure you have proper licensing for any video content you play.