增加码率选择器以及修复2处bug (#427)
* Prevent the ffmpeg-binary-path option from being accidentally overridden by the mux-after-done option. * Add bandwidth filter * Add bandwidth filter
This commit is contained in:
parent
508f39b649
commit
6cc09fa373
|
@ -477,7 +477,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
zhCN: "通过正则表达式选择符合要求的视频流. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
zhCN: "通过正则表达式选择符合要求的视频流. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
||||||
"id=REGEX:lang=REGEX:name=REGEX:codecs=REGEX:res=REGEX:frame=REGEX\r\n" +
|
"id=REGEX:lang=REGEX:name=REGEX:codecs=REGEX:res=REGEX:frame=REGEX\r\n" +
|
||||||
"segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX\r\n" +
|
"segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX\r\n" +
|
||||||
"plistDurMin=hms:plistDurMax=hms:role=string:for=FOR\r\n\r\n" +
|
"plistDurMin=hms:plistDurMax=hms:bwMin=int:bwMax=int:role=string:for=FOR\r\n\r\n" +
|
||||||
"* for=FOR: 选择方式. best[number], worst[number], all (默认: best)\r\n\r\n" +
|
"* for=FOR: 选择方式. best[number], worst[number], all (默认: best)\r\n\r\n" +
|
||||||
"例如: \r\n" +
|
"例如: \r\n" +
|
||||||
"# 选择最佳视频\r\n" +
|
"# 选择最佳视频\r\n" +
|
||||||
|
@ -486,11 +486,13 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sv res=\"3840*\":codecs=hvc1:for=best\r\n" +
|
"-sv res=\"3840*\":codecs=hvc1:for=best\r\n" +
|
||||||
"# 选择长度大于1小时20分钟30秒的视频\r\n" +
|
"# 选择长度大于1小时20分钟30秒的视频\r\n" +
|
||||||
"-sv plistDurMin=\"1h20m30s\":for=best\r\n" +
|
"-sv plistDurMin=\"1h20m30s\":for=best\r\n" +
|
||||||
"-sv role=\"main\":for:best\r\n",
|
"-sv role=\"main\":for=best\r\n" +
|
||||||
|
"# 选择码率在800Kbps至1Mbps之间的视频\r\n" +
|
||||||
|
"-sv bwMin=800:bwMax=1000\r\n",
|
||||||
zhTW: "通過正則表達式選擇符合要求的影片軌. 你能夠以:分隔形式指定如下參數:\r\n\r\n" +
|
zhTW: "通過正則表達式選擇符合要求的影片軌. 你能夠以:分隔形式指定如下參數:\r\n\r\n" +
|
||||||
"id=REGEX:lang=REGEX:name=REGEX:codecs=REGEX:res=REGEX:frame=REGEX\r\n" +
|
"id=REGEX:lang=REGEX:name=REGEX:codecs=REGEX:res=REGEX:frame=REGEX\r\n" +
|
||||||
"segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX\r\n" +
|
"segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX\r\n" +
|
||||||
"plistDurMin=hms:plistDurMax=hms:role=string:for=FOR\r\n\r\n" +
|
"plistDurMin=hms:plistDurMax=hms:bwMin=int:bwMax=int:role=string:for=FOR\r\n\r\n" +
|
||||||
"* for=FOR: 選擇方式. best[number], worst[number], all (默認: best)\r\n\r\n" +
|
"* for=FOR: 選擇方式. best[number], worst[number], all (默認: best)\r\n\r\n" +
|
||||||
"例如: \r\n" +
|
"例如: \r\n" +
|
||||||
"# 選擇最佳影片\r\n" +
|
"# 選擇最佳影片\r\n" +
|
||||||
|
@ -499,11 +501,13 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sv res=\"3840*\":codecs=hvc1:for=best\r\n" +
|
"-sv res=\"3840*\":codecs=hvc1:for=best\r\n" +
|
||||||
"# 選擇長度大於1小時20分鐘30秒的影片\r\n" +
|
"# 選擇長度大於1小時20分鐘30秒的影片\r\n" +
|
||||||
"-sv plistDurMin=\"1h20m30s\":for=best\r\n" +
|
"-sv plistDurMin=\"1h20m30s\":for=best\r\n" +
|
||||||
"-sv role=\"main\":for:best\r\n",
|
"-sv role=\"main\":for=best\r\n" +
|
||||||
|
"# 選擇碼率在800Kbps至1Mbps之間的影片\r\n" +
|
||||||
|
"-sv bwMin=800:bwMax=1000\r\n",
|
||||||
enUS: "Select video streams by regular expressions. OPTIONS is a colon separated list of:\r\n\r\n" +
|
enUS: "Select video streams by regular expressions. OPTIONS is a colon separated list of:\r\n\r\n" +
|
||||||
"id=REGEX:lang=REGEX:name=REGEX:codecs=REGEX:res=REGEX:frame=REGEX\r\n" +
|
"id=REGEX:lang=REGEX:name=REGEX:codecs=REGEX:res=REGEX:frame=REGEX\r\n" +
|
||||||
"segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX\r\n" +
|
"segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX\r\n" +
|
||||||
"plistDurMin=hms:plistDurMax=hms:role=string:for=FOR\r\n\r\n" +
|
"plistDurMin=hms:plistDurMax=hms:bwMin=int:bwMax=int:role=string:for=FOR\r\n\r\n" +
|
||||||
"* for=FOR: Select type. best[number], worst[number], all (Default: best)\r\n\r\n" +
|
"* for=FOR: Select type. best[number], worst[number], all (Default: best)\r\n\r\n" +
|
||||||
"Examples: \r\n" +
|
"Examples: \r\n" +
|
||||||
"# select best video\r\n" +
|
"# select best video\r\n" +
|
||||||
|
@ -512,7 +516,9 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sv res=\"3840*\":codecs=hvc1:for=best\r\n" +
|
"-sv res=\"3840*\":codecs=hvc1:for=best\r\n" +
|
||||||
"# Select best video with duration longer than 1 hour 20 minutes 30 seconds\r\n" +
|
"# Select best video with duration longer than 1 hour 20 minutes 30 seconds\r\n" +
|
||||||
"-sv plistDurMin=\"1h20m30s\":for=best\r\n" +
|
"-sv plistDurMin=\"1h20m30s\":for=best\r\n" +
|
||||||
"-sv role=\"main\":for:best\r\n"
|
"-sv role=\"main\":for=best\r\n" +
|
||||||
|
"# Select video with bandwidth between 800Kbps and 1Mbps\r\n" +
|
||||||
|
"-sv bwMin=800:bwMax=1000\r\n"
|
||||||
),
|
),
|
||||||
["cmd_selectAudio"] = new TextContainer
|
["cmd_selectAudio"] = new TextContainer
|
||||||
(
|
(
|
||||||
|
@ -536,7 +542,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sa lang=en:for=best\r\n" +
|
"-sa lang=en:for=best\r\n" +
|
||||||
"# 选择最佳的2条英语(或日语)音轨\r\n" +
|
"# 选择最佳的2条英语(或日语)音轨\r\n" +
|
||||||
"-sa lang=\"ja|en\":for=best2\r\n" +
|
"-sa lang=\"ja|en\":for=best2\r\n" +
|
||||||
"-sa role=\"main\":for:best\r\n",
|
"-sa role=\"main\":for=best\r\n",
|
||||||
zhTW: "通過正則表達式選擇符合要求的音軌. 參考 --select-video\r\n\r\n" +
|
zhTW: "通過正則表達式選擇符合要求的音軌. 參考 --select-video\r\n\r\n" +
|
||||||
"例如: \r\n" +
|
"例如: \r\n" +
|
||||||
"# 選擇所有音訊\r\n" +
|
"# 選擇所有音訊\r\n" +
|
||||||
|
@ -545,7 +551,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sa lang=en:for=best\r\n" +
|
"-sa lang=en:for=best\r\n" +
|
||||||
"# 選擇最佳的2條英語(或日語)音軌\r\n" +
|
"# 選擇最佳的2條英語(或日語)音軌\r\n" +
|
||||||
"-sa lang=\"ja|en\":for=best2\r\n" +
|
"-sa lang=\"ja|en\":for=best2\r\n" +
|
||||||
"-sa role=\"main\":for:best\r\n",
|
"-sa role=\"main\":for=best\r\n",
|
||||||
enUS: "Select audio streams by regular expressions. ref --select-video\r\n\r\n" +
|
enUS: "Select audio streams by regular expressions. ref --select-video\r\n\r\n" +
|
||||||
"Examples: \r\n" +
|
"Examples: \r\n" +
|
||||||
"# select all\r\n" +
|
"# select all\r\n" +
|
||||||
|
@ -554,7 +560,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sa lang=en:for=best\r\n" +
|
"-sa lang=en:for=best\r\n" +
|
||||||
"# select best 2, and language is ja or en\r\n" +
|
"# select best 2, and language is ja or en\r\n" +
|
||||||
"-sa lang=\"ja|en\":for=best2\r\n" +
|
"-sa lang=\"ja|en\":for=best2\r\n" +
|
||||||
"-sa role=\"main\":for:best\r\n"
|
"-sa role=\"main\":for=best\r\n"
|
||||||
),
|
),
|
||||||
["cmd_selectSubtitle"] = new TextContainer
|
["cmd_selectSubtitle"] = new TextContainer
|
||||||
(
|
(
|
||||||
|
|
|
@ -369,6 +369,14 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
if (!string.IsNullOrEmpty(plistDurMax))
|
if (!string.IsNullOrEmpty(plistDurMax))
|
||||||
streamFilter.PlaylistMaxDur = OtherUtil.ParseSeconds(plistDurMax);
|
streamFilter.PlaylistMaxDur = OtherUtil.ParseSeconds(plistDurMax);
|
||||||
|
|
||||||
|
var bwMin = p.GetValue("bwMin");
|
||||||
|
if (!string.IsNullOrEmpty(bwMin))
|
||||||
|
streamFilter.BandwidthMin = int.Parse(bwMin) * 1000;
|
||||||
|
|
||||||
|
var bwMax = p.GetValue("bwMax");
|
||||||
|
if (!string.IsNullOrEmpty(bwMax))
|
||||||
|
streamFilter.BandwidthMax = int.Parse(bwMax) * 1000;
|
||||||
|
|
||||||
var role = p.GetValue("role");
|
var role = p.GetValue("role");
|
||||||
if (System.Enum.TryParse(role, true, out RoleType roleType))
|
if (System.Enum.TryParse(role, true, out RoleType roleType))
|
||||||
streamFilter.Role = roleType;
|
streamFilter.Role = roleType;
|
||||||
|
@ -566,7 +574,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
option.MuxAfterDone = true;
|
option.MuxAfterDone = true;
|
||||||
option.MuxOptions = muxAfterDoneValue;
|
option.MuxOptions = muxAfterDoneValue;
|
||||||
if (muxAfterDoneValue.UseMkvmerge) option.MkvmergeBinaryPath = muxAfterDoneValue.BinPath;
|
if (muxAfterDoneValue.UseMkvmerge) option.MkvmergeBinaryPath = muxAfterDoneValue.BinPath;
|
||||||
else option.FFmpegBinaryPath = muxAfterDoneValue.BinPath;
|
else option.FFmpegBinaryPath ??= muxAfterDoneValue.BinPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace N_m3u8DL_RE.Entity
|
||||||
public long? SegmentsMaxCount { get; set; }
|
public long? SegmentsMaxCount { get; set; }
|
||||||
public double? PlaylistMinDur { get; set; }
|
public double? PlaylistMinDur { get; set; }
|
||||||
public double? PlaylistMaxDur { get; set; }
|
public double? PlaylistMaxDur { get; set; }
|
||||||
|
public int? BandwidthMin { get; set; }
|
||||||
|
public int? BandwidthMax { get; set; }
|
||||||
public RoleType? Role { get; set; }
|
public RoleType? Role { get; set; }
|
||||||
|
|
||||||
public string For { get; set; } = "best";
|
public string For { get; set; } = "best";
|
||||||
|
@ -44,6 +46,8 @@ namespace N_m3u8DL_RE.Entity
|
||||||
if (SegmentsMaxCount != null) sb.Append($"SegmentsMaxCount: {SegmentsMaxCount} ");
|
if (SegmentsMaxCount != null) sb.Append($"SegmentsMaxCount: {SegmentsMaxCount} ");
|
||||||
if (PlaylistMinDur != null) sb.Append($"PlaylistMinDur: {PlaylistMinDur} ");
|
if (PlaylistMinDur != null) sb.Append($"PlaylistMinDur: {PlaylistMinDur} ");
|
||||||
if (PlaylistMaxDur != null) sb.Append($"PlaylistMaxDur: {PlaylistMaxDur} ");
|
if (PlaylistMaxDur != null) sb.Append($"PlaylistMaxDur: {PlaylistMaxDur} ");
|
||||||
|
if (BandwidthMin != null) sb.Append($"{nameof(BandwidthMin)}: {BandwidthMin} ");
|
||||||
|
if (BandwidthMax != null) sb.Append($"{nameof(BandwidthMax)}: {BandwidthMax} ");
|
||||||
if (Role.HasValue) sb.Append($"Role: {Role} ");
|
if (Role.HasValue) sb.Append($"Role: {Role} ");
|
||||||
|
|
||||||
return sb.ToString() + $"For: {For}";
|
return sb.ToString() + $"For: {For}";
|
||||||
|
|
|
@ -46,6 +46,10 @@ namespace N_m3u8DL_RE.Util
|
||||||
inputs = inputs.Where(i => i.Playlist?.TotalDuration > filter.PlaylistMinDur);
|
inputs = inputs.Where(i => i.Playlist?.TotalDuration > filter.PlaylistMinDur);
|
||||||
if (filter.PlaylistMaxDur != null)
|
if (filter.PlaylistMaxDur != null)
|
||||||
inputs = inputs.Where(i => i.Playlist?.TotalDuration < filter.PlaylistMaxDur);
|
inputs = inputs.Where(i => i.Playlist?.TotalDuration < filter.PlaylistMaxDur);
|
||||||
|
if (filter.BandwidthMin != null)
|
||||||
|
inputs = inputs.Where(i => i.Bandwidth >= filter.BandwidthMin);
|
||||||
|
if (filter.BandwidthMax != null)
|
||||||
|
inputs = inputs.Where(i => i.Bandwidth <= filter.BandwidthMax);
|
||||||
if (filter.Role.HasValue)
|
if (filter.Role.HasValue)
|
||||||
inputs = inputs.Where(i => i.Role == filter.Role);
|
inputs = inputs.Where(i => i.Role == filter.Role);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue