lisamelton / video_transcoding

Tools to transcode, inspect and convert videos.
MIT License
2.39k stars 160 forks source link

Parse HandBrakeCLI JSON output (Fixes #234) #333

Open bloertscher opened 3 years ago

bloertscher commented 3 years ago

Uses the HandBrakeCLI --json option to get media info.

Tested with

I ran transcode-video --dry-run on a bunch of DVD directory rips and a couple of .mkv and .mp4 files with no options and compared the output between video_transcoding-0.25.3 and video_transcoding-0.26.0 (this PR). The output for all of those was the same. When I added --crop detect --add-audio "spa" --add-subtitle "eng,spa", the only difference was that subtitle tracks were correctly added. My video library is very limited, however, and I didn't play with any of the other options.

convert-video doesn't always select the correct streams (the stream IDs aren't available in the HandBrake JSON output). Should now select the streams correctly, though it will only get the first video stream (which I think matches the old behavior, and is probably the most common use case). detect-crop seems unaffected.

TODOs:

lisamelton commented 3 years ago

@bloertscher Thanks for the patch! I'll take a closer look at it in the next few days. In the meantime, keep iterating.