perl:打开文件夹,选择视频文件,并播放

在Windows10系统中Perl安装Tk模块

运行 cmd

cpan

install Tk

编写 openvideo.pl 如下

perl 复制代码
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
use Tk;

my $mw = MainWindow->new or die 'cannot create Widget';

my $types = [['AVI', '.avi'], ['MP4', '.mp4']];

my $file = $mw->getOpenFile(-initialdir=>'D:/VIDEO', -filetypes=>$types);
#print $file;

if ( -e $file){
    my $fname = basename($file);
    system("D:/FFModules/Encoder/mplayer.exe -title $fname -aspect 4:3 $file");
} else {
    print 'file is not exists.';
}
#MainLoop;

运行 perl openvideo.pl

如果你的PC安装了【 格式工厂】这个应用软件,那么实际安装了Windows版的 FFmpeg

在D:\FormatFactory\FFModules\Encoder\ 能找到 mplayer.exe 和 ffmpeg.exe

这里谈谈 mplayer 简单应用:mplayer -h

  1. 播放比例调整

mplayer -aspect 16:9 <videofile>

mplayer -aspect 4:3 <videofile>

  1. 控制热键

基本播放

→     前进10秒

←     后退10秒

↑     前进60秒

↓     后退60秒

PageUP  前进10分钟

PageDown 后退10分钟

Enter   全屏开关

Space   暂停开关

Esc    退出

q     退出


perldoc Encode

经过测试发现,即使 use Encode qw(decode encode); 也无法处理含中文的文件路径。

python 3 处理含中文的文件路径,没有问题。光凭这一点,python 就比 perl 更先进。

相关推荐
简鹿办公3 天前
FFmpeg vs 去水印软件:哪种方式更适合你?
ffmpeg·怎样去除视频水印·如何去视频logo视频水印
小狮子安度因4 天前
ffplay数据结构分析
数据结构·ffmpeg
小狮子安度因4 天前
ffplay音频重采样
ffmpeg·音视频
小狮子安度因4 天前
AAC ADTS格式分析
网络·ffmpeg·aac
勘察加熊人5 天前
ffmpeg切割音频
ffmpeg·音视频
xiaohouzi1122336 天前
Python读取视频-硬解和软解
python·opencv·ffmpeg·视频编解码·gstreamer
kimble_xia@oracle7 天前
性能优化笔记
ffmpeg
wang_chao1187 天前
RK3399平台ffmpeg-VPU硬编码录制USB摄像头视频、H264或MJPEG编码
ffmpeg·音视频
鹅毛在路上了8 天前
C++, ffmpeg, libavcodec-RTSP拉流,opencv实时预览
c++·opencv·ffmpeg
Hi202402179 天前
Orin-Apollo园区版本:订阅多个摄像头画面拼接与硬编码RTMP推流
ffmpeg·apollo·orin·图像拼接·图传