Closed VampiricAlien closed 1 year ago
Not really enough info to help
I assume the original file that's failing is created with SMA and also creating a new file with SMA fixes it?
Only time I've seen seeking issues is when trying to tag/add metadata AFTER qtfaststart or equivalent MOOV atom has been moved which if you're doing MKV doesn't apply
The new file is created with ffmpeg without the script. H.264 --> H.265 creates a new file but on some media the seek was broken but fixed by using ffmpeg copy command.
Is there any options to check this?
Check what?
I would maybe need to see some conversion logs from a file that's broken and perhaps send me a sample file that's not seeking
To check video time or seek?
I think I do have a log but I no longer have those files.
I don't think there's a programmatic way to see if this has occurred if that's what you're asking, but that's tough to say without seeing if there was some problem or error during the conversion process or looking to see if the file is malformed in some way. Usually its a problem with the wrapper and that's why recreating it using FFMPEG copy fixes things but if you have some logs I can take a look and see if anything stands out
This is what I could find in the logs
2023-09-24 13:39:03 - MANUAL - INFO - Reading video stream.
2023-09-24 13:39:03 - MANUAL - INFO - Video codec detected: h264.
2023-09-24 13:39:03 - MANUAL - INFO - Pix Fmt: yuv420p.
2023-09-24 13:39:03 - MANUAL - INFO - Profile: high.
2023-09-24 13:39:03 - MANUAL - INFO - Video codec parameters None.
2023-09-24 13:39:03 - MANUAL - INFO - Creating h265vaapi video stream from source stream 0.
2023-09-24 13:39:03 - MANUAL - INFO - Reading audio streams.
2023-09-24 13:39:03 - MANUAL - INFO - The following stream indexes have been identified as being copies: [] [stream-codec-combinations].
2023-09-24 13:39:03 - MANUAL - INFO - Audio detected for stream 1 - eac3 eng 2 channel.
2023-09-24 13:39:03 - MANUAL - INFO - Creating copy audio stream from source stream 1.
2023-09-24 13:39:03 - MANUAL - INFO - Found 0 streams that can be removed from the output file since they will be duplicates [stream-codec-combinations].
2023-09-24 13:39:03 - MANUAL - INFO - Final sorting:
2023-09-24 13:39:03 - MANUAL - INFO - ['0->0']
2023-09-24 13:39:03 - MANUAL - INFO - Final sorting:
2023-09-24 13:39:03 - MANUAL - INFO - ['0->0']
2023-09-24 13:39:03 - MANUAL - INFO - Default audio stream set to eng copy 2 channel stream [audio-default-sorting: ['codec']].
2023-09-24 13:39:03 - MANUAL - INFO - Reading subtitle streams.
2023-09-24 13:39:03 - MANUAL - INFO - Subtitle detected for stream 2 - subrip eng.
2023-09-24 13:39:03 - MANUAL - INFO - Stream 2 is text-based subtitle for codec subrip.
2023-09-24 13:39:03 - MANUAL - INFO - Ripping eng subtitle from source stream 2 into external file.
2023-09-24 13:39:06 - MANUAL - INFO - videofile-657-765-67.eng.srt created.
2023-09-24 13:39:06 - MANUAL - INFO - Subtitle videofile-657-765-67.eng.srt extracted for cleaning/syncing [subtitles.cleanit, subtitles.ffsubsync].
2023-09-24 13:39:06 - MANUAL - ERROR - Subtitle rip and cleaning failed.
Traceback (most recent call last):
File "/resources/mediaprocessor.py", line 1217, in generateOptions
self.cleanExternalSub(new_sub.path)
File "/resources/mediaprocessor.py", line 1806, in cleanExternalSub
sub = cleanit.Subtitle(path)
AttributeError: module 'cleanit' has no attribute 'Subtitle'
2023-09-24 13:39:06 - MANUAL - INFO - Creating copy subtitle stream from source stream 2.
2023-09-24 13:39:06 - MANUAL - INFO - Scanned for external subtitles and found 1 results in your approved languages.
2023-09-24 13:39:06 - MANUAL - INFO - Creating srt subtitle stream by importing Text-based subtitle Sea Patrol S05E12 Saving Ryan.eng.srt [embed-subs].
2023-09-24 13:39:06 - MANUAL - INFO - Final sorting:
2023-09-24 13:39:06 - MANUAL - INFO - ['0->0', '1->1']
2023-09-24 13:39:06 - MANUAL - INFO - vaapi hwaccel is supported by this ffmpeg build and will be used [hwaccels].
2023-09-24 13:39:06 - MANUAL - INFO - Output Data
2023-09-24 13:39:06 - MANUAL - INFO - {
"source": [
"videofile-657-765-67.mkv",
"videofile-657-765-67.eng.srt"
],
"format": "mkv",
"video": {
"codec": "h265vaapi",
"map": 0,
"bitrate": 12171.01145,
"crf": 0,
"maxrate": null,
"bufsize": null,
"level": 5.2,
"profile": "main10",
"preset": "veryslow",
"pix_fmt": "p010le",
"field_order": "progressive",
"width": null,
"filter": null,
"params": null,
"framedata": null,
"bsf": null,
"debug": "video.profile.pix_fmt",
"title": "FHD",
"device": "sma"
},
"audio": [
{
"map": 1,
"codec": "copy",
"channels": 2,
"bitrate": 256,
"profile": null,
"quality": 0,
"filter": "dynaudnorm",
"samplerate": null,
"sampleformat": "",
"language": "eng",
"disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions",
"bsf": null,
"debug": "universal-audio",
"title": "Stereo"
}
],
"subtitle": [
{
"map": 2,
"codec": "copy",
"language": "eng",
"disposition": "+default-dub-original-comment-lyrics-karaoke-forced+hearing_impaired-visual_impaired-captions",
"debug": "subtitle.embed-subs",
"title": "Hearing Impaired"
},
{
"source": 1,
"map": 0,
"codec": "srt",
"disposition": "-default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions",
"language": "eng",
"debug": "subtitle.embed-subs",
"title": null
}
],
"attachment": []
}
2023-09-24 13:39:06 - MANUAL - INFO - Preopts
2023-09-24 13:39:06 - MANUAL - INFO - [
"-fix_sub_duration",
"-init_hw_device",
"vaapi=sma:/dev/dri/renderD128",
"-hwaccel_device",
"sma",
"-hwaccel",
"vaapi",
"-hwaccel_output_format",
"vaapi"
]
2023-09-24 13:39:06 - MANUAL - INFO - Postopts
2023-09-24 13:39:06 - MANUAL - INFO - [
"-threads",
"0",
"-metadata:g",
"encoding_tool=SMA"
]
2023-09-24 13:39:06 - MANUAL - INFO - Starting conversion.
2023-09-24 13:39:06 - MANUAL - INFO - FFmpeg command:
2023-09-24 13:39:06 - MANUAL - INFO - ======================
2023-09-24 13:39:06 - MANUAL - INFO - /usr/bin/ffmpeg -fix_sub_duration -init_hw_device vaapi=sma:/dev/dri/renderD128 -hwaccel_device sma -hwaccel vaapi -hwaccel_output_format vaapi -i "videofile-657-765-67.mkv.original" -i "videofile-657-765-67.eng.srt" -vcodec hevc_vaapi -map 0:0 -field_order progressive -metadata:s:v title=FHD -metadata:s:v handler_name=FHD -preset veryslow -profile:v main10 -level 5.2 -tag:v hvc1 -qp 0 -filter_hw_device sma -vf "format=p010le|vaapi,hwupload,scale_vaapi=format=p010le" -c:a:0 copy -map 0:1 -metadata:s:a:0 title=Stereo -metadata:s:a:0 handler_name=Stereo -metadata:s:a:0 language=eng -disposition:a:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -c:s:0 copy -map 0:2 -metadata:s:s:0 "title=Hearing Impaired" -metadata:s:s:0 "handler_name=Hearing Impaired" -metadata:s:s:0 language=eng -disposition:s:0 +default-dub-original-comment-lyrics-karaoke-forced+hearing_impaired-visual_impaired-captions -c:s:1 srt -map 1:0 -metadata:s:s:1 title= -metadata:s:s:1 handler_name= -metadata:s:s:1 language=eng -disposition:s:1 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f matroska -threads 0 -metadata:g encoding_tool=SMA -y "videofile-657-765-67.mkv"
2023-09-24 13:39:06 - MANUAL - INFO - ======================
2023-09-24 13:51:20 - MANUAL - INFO - videofile-657-765-67.mkv created.
2023-09-24 13:51:20 - MANUAL - INFO - Tagging file: videofile-657-765-67.mkv.
2023-09-24 13:51:30 - MANUAL - INFO - Tags written successfully using FFMPEG fallback method.
2023-09-24 13:51:30 - MANUAL - INFO - Processing file videofile-657-765-67.mkv
Everything looks to be proceeding without any major issues (other than the cleanit error which is irrelevant)
I'm curious maybe if you try turning off tagging if that makes any impact but otherwise looks like an appropriate FFMPEG command is generated
Are you seeing this with every file or was it just a specific one?
Also I did just double check the latest cleanit version and that import error you're getting shouldn't be there so you might want to update/reinstall cleanit to fix that
That was my thoughts, nothing stood out to me in the log. It is very rare that it happens.
I did keep this bit of info from the file before fixing it. It's not a big deal since it doesn't happen a lot.
Metadata: encoder : libebml v1.3.7 + libmatroska v1.5.0 Duration: 00:43:02.53, start: 0.000000, bitrate: 13764 kb/s Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn (default) Metadata: BPS-eng : 13538527 DURATION-eng : 00:43:02.520000000 NUMBER_OF_FRAMES-eng: 64563 NUMBER_OF_BYTES-eng: 4370439621 _STATISTICS_WRITING_APP-eng: mkvmerge v32.0.0 ('Astral Progressions') 32-b
Off topic question before I close this.
How would i get the script to copy 'h265 yuv420p' video stream when it's not supported by my vaapi? the setting is 'h265 p010le' I took me awhile to pin point the error linked to pix-fmt, any ideas?
It will always remux a stream even with hardware acceleration if the stream doesn't break any rules so just add make sure to add the codec and pixfmt to the lists
If I add that to the list I get this error
No usable encoding profile found. [vost#0:0/hevc_vaapi @ 0x55a5d086f000] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed!
Is there another way to make sure all 265 video streams get copied?
Share your config it shouldn't be your first option. Please review in the wiki
[Video]
codec = h265vaapi
max-bitrate = 0
bitrate-ratio = 0.7
max-width = 0
preopts = -extra_hw_frames, 10
crf = -0
preset = veryslow
codec-parameters =
dynamic-parameters = True
profile = main10
max-level = 5.2
pix-fmt = p010le, yuv420p10le
prioritize-source-pix-fmt = True
filter =
force-filter = False
crf-profiles =
pix-fmt csv Supported pix-fmt list. Formats not on this list are be converted to the first format on the list
prioritize-source-pix-fmt bool True When decided pix_fmt, the script will attempt to keep the same format as long as it's included on the allowed list if video conversion must take place, set to False to use the first pix_fmt on the list instead if conversion must take place (will not impact conversion needed decisions)
If you're getting the error above that means its still not copying, the "debug" tag on the json data usually tells you why its not getting copied
Depending on your specific needs you can also potentially just leave pix_fmt blank
IO... p010le 3 15 10-10-10
p010le isn't a hardware accelerated format so that shouldn't be your first choice since you're trying to use VAAPI
ffmpeg -pix_fmts
will give you a list of your ffmpeg builds supported pix_fmts
You'll also probably need to play around with prioritize-source-pix-fmt = True
as it might need to be set to false in situations where you need to convert
Sharing the full logs would be helpful too
Drop 10 from main and changed other settings like you suggested, it now copies over. As for ffmpeg -pix_fmts
didn't really give anything to use for hardware.
profile = main max-level = 5.2 pix-fmt = nv12, p010le, yuv420p10le, yuv420p prioritize-source-pix-fmt = False
], "format": "mkv", "video": { "codec": "copy", "map": 0, "bitrate": 12889.31785, "crf": 0, "maxrate": null, "bufsize": null, "level": 5.2, "profile": "main", "preset": "veryslow", "pix_fmt": "nv12", "field_order": "unknown", "width": null, "filter": null, "params": null, "framedata": null, "bsf": null, "debug": "video", "title": "4K
I can make a suggestion?
Within the wiki, having a little area for tips and tricks or FAQs.
Thank you for the help.
`HEVC after process: ENCODER : Lavf60.3.100 Duration: 00:38:39.94, start: -0.005000, bitrate: 2003 kb/s Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn (default)
Before: encoder : libebml v1.4.4 + libmatroska v1.7.1 Duration: 00:38:39.94, start: 0.000000, bitrate: 8796 kb/s Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn (default)`
I notice start: -0.005000 after the script was finished on the last ran, I think this can be fixed with -ss 0.00000
Sometimes I can only watch from the beginning and can’t seek through the video, if I do it starts at the beginning again.
Do you know why or how this would happen? creating a new file fixes the issue.