[Enhancement] Improve support for 4k videos with Plex (#181)
* Added WIP 4k MP4 fix [skip ci] * Added tests for new remux options
This commit is contained in:
parent
c36e33e1fd
commit
f2a7463ff3
2 changed files with 11 additions and 6 deletions
|
|
@ -106,16 +106,18 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp quality_options(media_profile) do
|
defp quality_options(media_profile) do
|
||||||
video_codec_options = "+codec:avc:m4a"
|
video_codec_option = fn res ->
|
||||||
|
[format_sort: "res:#{res},+codec:avc:m4a", remux_video: "mp4"]
|
||||||
|
end
|
||||||
|
|
||||||
case media_profile.preferred_resolution do
|
case media_profile.preferred_resolution do
|
||||||
# Also be aware that :audio disabled all embedding options for subtitles
|
# Also be aware that :audio disabled all embedding options for subtitles
|
||||||
:audio -> [:extract_audio, format: "bestaudio[ext=m4a]"]
|
:audio -> [:extract_audio, format: "bestaudio[ext=m4a]"]
|
||||||
:"360p" -> [format_sort: "res:360,#{video_codec_options}"]
|
:"360p" -> video_codec_option.("360")
|
||||||
:"480p" -> [format_sort: "res:480,#{video_codec_options}"]
|
:"480p" -> video_codec_option.("480")
|
||||||
:"720p" -> [format_sort: "res:720,#{video_codec_options}"]
|
:"720p" -> video_codec_option.("720")
|
||||||
:"1080p" -> [format_sort: "res:1080,#{video_codec_options}"]
|
:"1080p" -> video_codec_option.("1080")
|
||||||
:"2160p" -> [format_sort: "res:2160,#{video_codec_options}"]
|
:"2160p" -> video_codec_option.("2160")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilderTest do
|
||||||
|
|
||||||
assert {:ok, res} = DownloadOptionBuilder.build(media_item)
|
assert {:ok, res} = DownloadOptionBuilder.build(media_item)
|
||||||
assert {:format_sort, "res:#{resolution},+codec:avc:m4a"} in res
|
assert {:format_sort, "res:#{resolution},+codec:avc:m4a"} in res
|
||||||
|
assert {:remux_video, "mp4"} in res
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -250,6 +251,8 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilderTest do
|
||||||
|
|
||||||
assert :extract_audio in res
|
assert :extract_audio in res
|
||||||
assert {:format, "bestaudio[ext=m4a]"} in res
|
assert {:format, "bestaudio[ext=m4a]"} in res
|
||||||
|
|
||||||
|
refute {:remux_video, "mp4"} in res
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue