Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
播放设置
Browse files Browse the repository at this point in the history
  • Loading branch information
januwA committed Oct 6, 2020
1 parent 3ead5b0 commit 473efe4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 25 deletions.
31 changes: 20 additions & 11 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,27 @@
</DockPanel>
</GroupBox>
<GroupBox Header="普通工具">
<WrapPanel Orientation="Horizontal">
<Button Content="去掉视频音轨" Click="Button_Click_2" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Button Content="提取视频音轨" Click="Button_Click" VerticalAlignment="Center" Margin="0,0,8,0"/>
<StackPanel Orientation="Horizontal" Margin="0,0,8,0">
<Button Content="调整音量" Click="Button_Click_3" VerticalAlignment="Center"/>
<TextBox x:Name="inputVolume" Width="40" VerticalAlignment="Center" Text="1.0"/>
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<Button Content="去掉视频音轨" Click="Button_Click_2" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Button Content="提取视频音轨" Click="Button_Click" VerticalAlignment="Center" Margin="0,0,8,0"/>
<StackPanel Orientation="Horizontal" Margin="0,0,8,0">
<Button Content="调整音量" Click="Button_Click_3" VerticalAlignment="Center"/>
<TextBox x:Name="inputVolume" Width="40" VerticalAlignment="Center" Text="1.0"/>
</StackPanel>
<Button Content="下载m3u8到MP4" VerticalAlignment="Center" Click="Button_Click_22" Margin="0,0,8,0"/>
<Button Content="转为MP4" VerticalAlignment="Center" Margin="0,0,8,0" Click="Button_Click_23"></Button>
</StackPanel>
<Button Content="播放" VerticalAlignment="Center" Click="Button_Click_5" Margin="0,0,8,0"/>
<Button Content="循环播放" VerticalAlignment="Center" Click="Button_Click_16" Margin="0,0,8,0"/>
<Button Content="下载m3u8到MP4" VerticalAlignment="Center" Click="Button_Click_22" Margin="0,0,8,0"/>
<Button Content="转为MP4" VerticalAlignment="Center" Margin="0,0,8,0" Click="Button_Click_23"></Button>
</WrapPanel>
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="isLoopPlay" IsChecked="True" VerticalAlignment="Center" Margin="0,0,8,0">循环</CheckBox>
<CheckBox x:Name="t_noborder" VerticalAlignment="Center" Margin="0,0,8,0">无边框</CheckBox>
<CheckBox x:Name="t_vn" VerticalAlignment="Center" Margin="0,0,8,0">禁用视频</CheckBox>
<CheckBox x:Name="t_an" VerticalAlignment="Center" Margin="0,0,8,0">禁用音频</CheckBox>
<TextBox x:Name="t_size" VerticalAlignment="Center" Margin="0,0,4,0">1280x720</TextBox>
<Button Content="播放" VerticalAlignment="Center" Click="Button_Click_5" Margin="0,0,8,0"/>
<Button Content="播放时" VerticalAlignment="Center" Foreground="Blue" BorderBrush="Transparent" Background="Transparent" Click="Button_Click_16"></Button>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="合并音视频">
<StackPanel>
Expand Down
47 changes: 34 additions & 13 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using io = System.IO;
using System.Windows;
using System.Text.RegularExpressions;
using System.Collections;

namespace WpfApp1
{
Expand Down Expand Up @@ -188,23 +189,26 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
private void Button_Click_5(object sender, RoutedEventArgs e)
{
if (checkNotInputFile()) return;
string command = $"\"{input}\"";
System.Diagnostics.Process.Start(ffplayExe, command);
}
ArrayList options = new ArrayList();
if (isLoopPlay.IsChecked == true) options.Add("-loop 0");
if (t_vn.IsChecked == true) options.Add("-vn");
if (t_an.IsChecked == true) options.Add("-an");
if (t_noborder.IsChecked == true) options.Add("-noborder");

string[] size = t_size.Text.Split('x');
if (size.Length == 2)
{
if (size[0].Length != 0) options.Add($"-x {size[0]}");
if (size[1].Length != 0) options.Add($"-y {size[1]}");
}

options.Add($"\"{input}\"");

string command = string.Join(" ", (string[])options.ToArray(Type.GetType("System.String")));

/// <summary>
/// 循环播放输入文件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_16(object sender, RoutedEventArgs e)
{
if (checkNotInputFile()) return;
string command = $"-loop 0 \"{input}\"";
System.Diagnostics.Process.Start(ffplayExe, command);
}


/// <summary>
/// 音频填充视频
/// </summary>
Expand Down Expand Up @@ -613,5 +617,22 @@ private void Button_Click_28(object sender, RoutedEventArgs e)
string command = $"-i \"{input}\" -b:v {toBitrate.Text} -c:a copy \"{oout}\"";
execute(command);
}

/// <summary>
/// 播放时控制器详情
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_16(object sender, RoutedEventArgs e)
{
MessageBox.Show(
"f 切换全屏\n"+
"p 却换暂停\n"+
"m 切换静音\n"+
"9,0 减少和增加音量\n"+
"left/right 向后/向前搜索10秒\n" +
"down/up 向后/向前搜索1分钟\n"
);
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
- [下载ffmpeg.exe](https://github.com/BtbN/FFmpeg-Builds/releases)(lgpl.zip),然后将bin目录添加到PATH环境变量,或者将bin下面的exe拷贝到本软件的exe同级目录下
- 没有找到ffmpeg.exe将无法运行

![](./images/2020-10-01-15-12-12.png)
![](./images/2020-10-06-22-14-28.png)
Binary file added images/2020-10-06-22-14-28.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 473efe4

Please sign in to comment.