diff --git a/README.md b/README.md index b638501..3690531 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ See the server version: [ytclip-server](https://github.com/zackees/ytclip-server # Releases + * 1.2.10: Adds `--crf` to control bit rate encoding. * 1.2.9: Drm video now detected properly and an output error message is emitted. * 1.2.8: Minimum version of `yt-dlp` bumped. Adds `--upgrade` for upgrading `yt-dlp` * 1.2.7: Brighteon downloads have been fixed, thanks to the brighteon plugin. diff --git a/upload_package.sh b/upload_package.sh index bcd4071..86974c4 100644 --- a/upload_package.sh +++ b/upload_package.sh @@ -1 +1,2 @@ +pip install twine python setup.py upload \ No newline at end of file diff --git a/ytclip/cmd.py b/ytclip/cmd.py index 4b746e6..78c029a 100644 --- a/ytclip/cmd.py +++ b/ytclip/cmd.py @@ -44,6 +44,7 @@ def run() -> int: # pylint: disable=too-many-branches,too-many-statements parser.add_argument("--outname", help="output name of the file (auto saved as mp4)") parser.add_argument("--keep", action="store_true", help="keeps intermediate files") parser.add_argument("--upgrade", action="store_true", help="Upgrades yt-dlp") + parser.add_argument("--crf", type=int, default=None, help="CRF value for video encoding") args = parser.parse_args() if args.version: print(f"{VERSION}") @@ -81,6 +82,7 @@ def run() -> int: # pylint: disable=too-many-branches,too-many-statements verbose=True, keep=args.keep, log=not args.no_log, + crf=args.crf, ) if os.path.exists(f"{outname}.mp4"): return 0 diff --git a/ytclip/version.py b/ytclip/version.py index 8e24518..ddeb62e 100644 --- a/ytclip/version.py +++ b/ytclip/version.py @@ -1,3 +1,3 @@ """Just holds the version for the app""" -VERSION = "1.2.9" +VERSION = "1.2.10" diff --git a/ytclip/ytclip.py b/ytclip/ytclip.py index 604b58b..e8b4a2a 100644 --- a/ytclip/ytclip.py +++ b/ytclip/ytclip.py @@ -70,7 +70,8 @@ def run_download_and_cut( # pylint: disable=too-many-arguments,too-many-locals, outname: str, log: bool = True, verbose: bool = False, - keep=False, + keep: bool = False, + crf: Optional[int] = None, ) -> None: """Runs a series of commands that downloads and cuts the given url to output filename.""" url = _clean_yt_url(url) @@ -168,6 +169,8 @@ def rank_file(file: str): ffmpeg_cmd += f" -ss {start_timestamp}" if end_timestamp: ffmpeg_cmd += f" -to {end_timestamp}" + if crf is not None: + ffmpeg_cmd += f' -crf {crf}' ffmpeg_cmd += f' "{outfile}"' if log: _append_file(outlog, f"Running: {ffmpeg_cmd}\nin {outname}") @@ -209,6 +212,7 @@ def unit_test_brighteon(): "10:47", "11:07", "health_ranger_report", + crf=23, ) @@ -219,6 +223,7 @@ def unit_test_bitchute(): "08:08", "08:28", "sarah_westhall", + crf=23, ) @@ -288,6 +293,7 @@ def unit_test_rap_video(): start_timestamp="00:32", end_timestamp="00:34", outname="myoutputfile", + crf=23, ) @@ -297,6 +303,7 @@ def unit_test_rap_video(): start_timestamp="", end_timestamp="", outname="myoutputfile", + crf=23, ) # unit_test_brighteon() # unit_test_stdout_parse()