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

相关推荐
肥or胖12 小时前
【FFmpeg 快速入门】本地播放器 项目
开发语言·qt·ffmpeg·音视频
笑虾12 小时前
bat 批处理实现 FFmpeg 命令导出 mov 到 png 序列帧
ffmpeg·png·mov·序列帧
Ashlee_code16 小时前
裂变时刻:全球关税重构下的券商交易系统跃迁路线图(2025-2027)
java·大数据·数据结构·python·云原生·区块链·perl
mortimer2 天前
当AI配音遇上视频:实现音画同步的自动化工程实践
python·ffmpeg·ai编程
甲方求你学点技术吧4 天前
8:从USB摄像头把声音拿出来--ALSA大佬登场!
linux·图像处理·ffmpeg·音视频
hjjdebug4 天前
ffmpeg 中 write_option()函数详细注释
ffmpeg·write_option
biubiubiu07065 天前
FFmpeg Windows安装
windows·ffmpeg
Gene_20225 天前
[TOOL] ubuntu 使用 ffmpeg 操作 gif、mp4
linux·ubuntu·ffmpeg
xhBruce5 天前
FFmpeg+javacpp中av_log使用
ffmpeg·ffmpeg+javacpp
开开心心就好5 天前
专业PPT图片提取工具,操作简单
javascript·电脑·powerpoint·scala·erlang·perl·myeclipse