【简易广告机】利用树莓派制作一个简易的广告机(2)

【简易广告机】利用树莓派制作一个简易的广告机

上次我们安装了 omxplayer 这次我们进行shell编程,让play这个文件夹内的所有视频文件循环播放
废话少说,上shell代码

#!/bin/sh 

# get rid of the cursor so we don't see it when videos are running 
#setterm -cursor off 

# set here the path to the directory containing your videos 
# 当前目录
VIDEOPATH="./" 

# you can normally leave this alone 
SERVICE="omxplayer" 

#无限循环当前目录的视频
while true
do
    for entry in $VIDEOPATH/* 
        do 
        echo $entry;
        sudo $SERVICE -o hdmi $entry
        done  
done

完成后把脚本文件放入视频文件所在的文件夹,然后赋予脚本可执行权限,执行:

pi@raspberrypi:~/pilearn/play $ chmod 777 play.sh 
pi@raspberrypi:~/pilearn/play $ ./play.sh 
.//gaobaiqiqiu.mp4
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Video codec omx-h264 width 720 height 480 profile 100 fps 24.000000
Audio codec aac channels 2 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 720x480@24.00 interlace:0 deinterlace:0 anaglyph:0 par:1.19 display:0 layer:0 alpha:255 aspectMode:0

不出意外的话,现在链接树莓派的显示器现在正在播放视频了

到这里,最为一个linux小白,该如何远程的把视频文件放入到树莓派的视频播放文件夹中呢?

那么该需要Linux应用编程了,鄙人对python一窍不通,对C语言颇感兴趣,那么就用C语言来编写网络编程吧 😃。

编程思想如下:

树莓派——客户端
电脑——服务端

设备心跳:
客户端 ——> 请求 ——> 服务端响应

音视频下载:
服务端 ——>下发 ——> 客户端响应

鄙人不才,只能做一成这么简易 😃

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值