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 更先进。

相关推荐
aaon223571 天前
ubuntu ffmpeg 安装踩坑
linux·ubuntu·ffmpeg
m0_748245171 天前
SpringCloud-使用FFmpeg对视频压缩处理
spring·spring cloud·ffmpeg
iummature1 天前
FFmpeg命令
ffmpeg
渔舟唱晚@1 天前
FFmpeg+WebSocket+JsMpeg实时视频流实现方案
websocket·网络协议·ffmpeg
xcg3401232 天前
关于视频抽帧调用虹软人脸识别的BufferedImage读取优化策略
ffmpeg·音视频·视频抽帧
繁依Fanyi2 天前
使用 FFmpeg 剪辑视频指南
java·服务器·开发语言·ffmpeg·音视频
deadknight93 天前
定期自动统计大表执行情况
ffmpeg
cuijiecheng20185 天前
音视频入门基础:RTP专题(9)——FFmpeg接收RTP流的原理和内部实现
ffmpeg·音视频
偶是老李头5 天前
Ubuntu虚拟机NDK编译ffmpeg
linux·ubuntu·ffmpeg·android ndk
lucky-billy5 天前
Qt 中使用 ffmpeg 获取采集卡数据录制视频
qt·ffmpeg·音视频