mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.51k stars 201 forks source link

Won't convert form h.265 (hevc) to h.264 #1526

Closed Sandwich1699975 closed 2 years ago

Sandwich1699975 commented 2 years ago

Terminal input:

PS C:\Users\Fredd\sickbeard_mp4_automator> python .\manual.py -i "F:\Media\TV Shows\The Grand Tour (2016)\Season 1" -a
Manual processor started.
Python 64-bit 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)].
Guessit version: 3.4.3.
C:\Users\Fredd\AppData\Local\Programs\Python\Python310\python.exe
Loading config file C:\Users\Fredd\sickbeard_mp4_automator\config\autoProcess.ini.
Processing file F:\Media\TV Shows\The Grand Tour (2016)\Season 1\The.Grand.Tour.2016.S01E01.1080p.WEBRip.x265-RARBG.mp4
Matched TV episode as The Grand Tour (TMDB ID: 67557) S01E01
Processing The Grand Tour Season 01 Episode 01 - The Holy Trinity
Input Data:
{
    "format": "mov,mp4,m4a,3gp,3g2,mj2",
    "format-fullname": "QuickTime / MOV",
    "video": {
        "index": 0,
        "codec": "hevc",
        "bitrate": 2000644,
        "pix_fmt": "yuv420p10le",
        "profile": "main10",
        "fps": 23.976023976023978,
        "framedata": {
            "pix_fmt": "yuv420p10le",
            "side_data_list": [
                {
                    "side_data_type": "H.26[45] User Data Unregistered SEI message"
                }
            ]
        },
        "dimensions": "1920x1080",
        "level": 4.0,
        "field_order": "unknown"
    },
    "audio": [
        {
            "index": 1,
            "codec": "aac",
            "bitrate": 224000,
            "channels": 6,
            "samplerate": 48000,
            "language": "eng",
            "disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions"
        }
    ],
    "subtitle": [],
    "attachment": []
}
Reading video stream.
Video codec detected: hevc.
Pix Fmt: yuv420p10le.
Profile: main10.
Video codec parameters None.
Creating h264 video stream from source stream 0.
Reading audio streams.
The following stream indexes have been identified as being copies: [] [stream-codec-combinations].
Audio detected for stream 1 - aac eng 6 channel.
Creating ac3 audio stream from source stream 1.
Creating aac audio stream from source audio stream 1 [universal-audio].
Found 0 streams that can be removed from the output file since they will dupcliates [stream-codec-combinations].
Default audio stream set to eng ac3 6 channel stream [default-more-channels: True].
Reading subtitle streams.
Scanned for external subtitles and found 0 results in your approved languages.
Input and output extensions are the same so passing back the original file [process-same-extensions: False].
Bypassing conversion and setting outputfile to inputfile.
Tagging file: F:\Media\TV Shows\The Grand Tour (2016)\Season 1\The.Grand.Tour.2016.S01E01.1080p.WEBRip.x265-RARBG.mp4.
Trying to write tags.
Tags written successfully using mutagen.
Relocating MOOV atom to start of file.
QT FastStart did not run - perhaps moov atom was at the start already or file is in the wrong format.
{
    "input": "F:\\Media\\TV Shows\\The Grand Tour (2016)\\Season 1\\The.Grand.Tour.2016.S01E01.1080p.WEBRip.x265-RARBG.mp4",
    "input_extension": "mp4",
    "input_deleted": false,
    "output": "F:\\Media\\TV Shows\\The Grand Tour (2016)\\Season 1\\The.Grand.Tour.2016.S01E01.1080p.WEBRip.x265-RARBG.mp4",
    "output_extension": "mp4",
    "options": {
        "source": [
            "F:\\Media\\TV Shows\\The Grand Tour (2016)\\Season 1\\The.Grand.Tour.2016.S01E01.1080p.WEBRip.x265-RARBG.mp4"
        ],
        "format": "mp4",
        "video": {
            "codec": "h264",
            "map": 0,
            "bitrate": 1909.4629499999999,
            "crf": -1,
            "maxrate": null,
            "bufsize": null,
            "level": 0.0,
            "profile": null,
            "preset": null,
            "pix_fmt": null,
            "field_order": "unknown",
            "width": null,
            "filter": null,
            "params": null,
            "framedata": null,
            "title": "FHD",
            "debug": "video"
        },
        "audio": [
            {
                "map": 1,
                "codec": "aac",
                "channels": 2,
                "bitrate": 256,
                "quality": 0,
                "profile": null,
                "samplerate": null,
                "sampleformat": "",
                "filter": "pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE",
                "language": "eng",
                "disposition": "-default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions",
                "title": "Stereo",
                "debug": "universal-audio"
            },
            {
                "map": 1,
                "codec": "ac3",
                "channels": 6,
                "bitrate": 768,
                "profile": null,
                "quality": 0,
                "filter": null,
                "samplerate": null,
                "sampleformat": "",
                "language": "eng",
                "disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions",
                "bsf": null,
                "title": "5.1 Channel",
                "debug": "audio"
            }
        ],
        "subtitle": [],
        "attachment": []
    },
    "preopts": [],
    "postopts": [
        "-threads",
        "0",
        "-metadata:g",
        "encoding_tool=SMA"
    ],
    "external_subs": [],
    "x": 1920,
    "y": 1080
}

VLC Analysis:

VLC Codec Information


autoProcess.ini

[Converter]
ffmpeg = C:\ffmpeg-2022-01-24-git-0a83ecbf48-full_build\bin\ffmpeg.exe
ffprobe = C:\ffmpeg-2022-01-24-git-0a83ecbf48-full_build\bin\ffprobe.exe
threads = 0
hwaccels = 
hwaccel-decoders = h264_cuvid, mjpeg_cuvid, mpeg1_cuvid, mpeg2_cuvid, mpeg4_cuvid, vc1_cuvid, hevc_qsv, h264_qsv, hevc_vaapi, h264_vaapi
hwdevices = vaapi:/dev/dri/renderD128
hwaccel-output-format = vaapi:vaapi
output-directory = 
output-format = mp4
output-extension = mp4
temp-extension = 
minimum-size = 0
ignored-extensions = nfo, ds_store
copy-to = 
move-to = 
delete-original = True
sort-streams = True
process-same-extensions = False
bypass-if-copying-all = False
force-convert = False
post-process = False
wait-post-process = False
detailed-progress = False
opts-separator = ,
preopts = 
postopts = 
regex-directory-replace = [^\w\-_\. ]

[Permissions]
chmod = 0644
uid = -1
gid = -1

[Metadata]
relocate-moov = True
full-path-guess = True
tag = True
tag-language = eng
download-artwork = poster
sanitize-disposition = 
strip-metadata = False
keep-titles = False

[Video]
codec = h264
max-bitrate = 0
bitrate-ratio = 
crf = -1
crf-profiles = 
preset = 
codec-parameters = 
dynamic-parameters = False
max-width = 0
profile = 
max-level = 0.0
pix-fmt = 
filter = 
force-filter = False

[HDR]
codec = 
pix-fmt = 
space = bt2020nc
transfer = smpte2084
primaries = bt2020
preset = 
codec-parameters = 
filter = 
force-filter = False
profile = 

[Audio]
codec = ac3
languages = 
default-language = 
first-stream-of-language = False
allow-language-relax = True
channel-bitrate = 128
variable-bitrate = 0
max-bitrate = 0
max-channels = 0
prefer-more-channels = True
default-more-channels = True
profile = 
filter = 
force-filter = False
sample-rates = 
sample-format = 
copy-original = False
copy-original-before = False
aac-adtstoasc = False
ignore-truehd = mp4, m4v
ignored-dispositions = 
unique-dispositions = False
stream-codec-combinations = 

[Universal Audio]
codec = aac
channel-bitrate = 128
variable-bitrate = 0
first-stream-only = False
move-after = False
profile = 
filter = 
force-filter = False

[Audio.ChannelFilters]
6-2 = pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE

[Subtitle]
codec = mov_text
codec-image-based = 
languages = 
default-language = 
first-stream-of-language = False
encoding = 
burn-subtitles = False
burn-dispositions = 
embed-subs = True
embed-image-subs = False
embed-only-internal-subs = False
filename-dispositions = forced
ignore-embedded-subs = False
ignored-dispositions = 
unique-dispositions = False
attachment-codec = 

[Subtitle.Subliminal]
download-subs = False
download-hearing-impaired-subs = False
providers = 

[Subtitle.Subliminal.Auth]
opensubtitles = 
tvsubtitles = 

[Sonarr]
host = localhost
port = 8989
apikey = 
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False

[Radarr]
host = localhost
port = 7878
apikey = 
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False

[Sickbeard]
host = localhost
port = 8081
ssl = False
apikey = 
webroot = 
username = 
password = 

[Sickrage]
host = localhost
port = 8081
ssl = False
apikey = 
webroot = 
username = 
password = 

[SABNZBD]
convert = True
sickbeard-category = sickbeard
sickrage-category = sickrage
sonarr-category = sonarr
radarr-category = radarr
bypass-category = bypass
output-directory = 
path-mapping = 

[Deluge]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
host = localhost
port = 58846
username = 
password = 
output-directory = 
remove = False
path-mapping = 

[qBittorrent]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
action-before = 
action-after = 
host = localhost
port = 8080
ssl = False
username = 
password = 
output-directory = 
path-mapping = 

[uTorrent]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
webui = False
action-before = 
action-after = 
host = localhost
ssl = False
port = 8080
username = 
password = 
output-directory = 
path-mapping = 

[Plex]
host = localhost
port = 32400
refresh = False
token = 

Why doesn't it recognize it as needing conversion?

I've changed the config file video codecs to only have h264.
Do I need to config h,265 as different or use the force conversion flag?

I can also confirm that my setup worked with a folder full of .MKV videos too.

Any help is much appreciated. I'm more than happy to respond with more valid information if needed.

mdhiggins commented 2 years ago
Input and output extensions are the same so passing back the original file [process-same-extensions: False].
Bypassing conversion and setting outputfile to inputfile.

It tells you why and includes the option that's relevant in the logs

Set process-same-extensions = True

Sandwich1699975 commented 2 years ago

Worked, thank you

I changed:

mdhiggins commented 2 years ago

Be cautious using force-convert along with universal audio as you may end up endlessly duplicating audio streams if you process the same file multiple times

There a couple fail safes to mitigate this, the script will attempt to bypass conversion in some cases if it looks like everything is in the correct format but only if force-convert is not enabled

You can also play around with the stream-codec-combinations option which is discussed in more detail here https://github.com/mdhiggins/sickbeard_mp4_automator/issues/1465#issuecomment-903302219 to help prevent this if you do wish to keep -fc enabled

Sandwich1699975 commented 2 years ago

Be cautious using force-convert along with universal audio as you may end up endlessly duplicating audio streams if you process the same file multiple times

There a couple fail safes to mitigate this, the script will attempt to bypass conversion in some cases if it looks like everything is in the correct format but only if force-convert is not enabled

You can also play around with the stream-codec-combinations option which is discussed in more detail here #1465 (comment) to help prevent this if you do wish to keep -fc enabled

Noted, I should be ok flagging -fc just this once. As I'm doing this folder once manually