Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard 8-bit H.264 profile #30

Open
Naomi010Sentzke opened this issue Sep 24, 2019 · 8 comments
Open

Standard 8-bit H.264 profile #30

Naomi010Sentzke opened this issue Sep 24, 2019 · 8 comments

Comments

@Naomi010Sentzke
Copy link

I am trying to make a profile that records a clip in standard 8-bit in a mp4 container and hardsubs the subtitles.

only_active_tracks=yes
preserve_filters=yes
append_filter=
codec= -c:v libx264 -profile:v high -level 4.2 -pix_fmt yuv420p -crf 13 -c:a libfdk_aac -b:a 128k
output_format=$f_$n.mp4
output_directory=
detached=yes
ffmpeg_command=ffmpeg
print=yes

Any suggestions ?

@occivink
Copy link
Owner

So what is the problem?

@Naomi010Sentzke
Copy link
Author

It does not work. I set it with Shift+e script-message-to encode set-timestamp encode_custom. I can set the timestamps, but when I press Enter to encode nothing happens unlike encode_slice and encode_webm.

@occivink
Copy link
Owner

This particular config seems to work for me, can you set detached=no and run mpv from a terminal, so that you see ffmpeg's error output?

@Naomi010Sentzke
Copy link
Author

It said failed to encode, check log for details

[  13.444][d][cplayer] Run command: show-text, flags=64, args=[encode [encode_custom]: waiting for end timestamp, 2000, 0]
[  15.445][d][cplayer] Run command: show-text, flags=64, args=[encode [encode_custom]: waiting for end timestamp, 2000, 0]
[  15.571][d][cplayer] Run command: script-binding, flags=73, args=[encode/encode-ENTER]
[  15.571][d][cplayer] Run command: define-section, flags=64, args=[input_encode, , default]
[  15.571][d][cplayer] Run command: enable-section, flags=64, args=[input_encode, allow-hide-cursor+allow-vo-dragging]
[  15.571][d][cplayer] Run command: define-section, flags=64, args=[input_forced_encode, ENTER script-binding encode/encode-ENTER
[  15.571][d][cplayer] , force]
[  15.571][d][cplayer] Run command: enable-section, flags=64, args=[input_forced_encode, allow-hide-cursor+allow-vo-dragging]
[  15.571][d][cplayer] Run command: define-section, flags=64, args=[input_encode, , default]
[  15.571][d][cplayer] Run command: enable-section, flags=64, args=[input_encode, allow-hide-cursor+allow-vo-dragging]
[  15.571][d][cplayer] Run command: define-section, flags=64, args=[input_forced_encode, , force]
[  15.572][d][cplayer] Run command: enable-section, flags=64, args=[input_forced_encode, allow-hide-cursor+allow-vo-dragging]
[  15.572][d][cplayer] Run command: show-text, flags=64, args=[, 0, 0]
[  15.572][d][cplayer] Run command: show-text, flags=64, args=[Encoding from 00:00.000 to 01:04.314, 2000, 0]
[  15.572][d][encode] reading options for encode_custom 
[  15.576][i][encode] ffmpeg -ss 00:00.000 -i 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3].mkv' -to 64.3348541661 -map 0:0 -map 0:1 -map 0:2 -c:v libx264 -profile:v high -level 4.2 -pix_fmt yuv420p -crf 13 -c:a libfdk_aac -b:a 128k 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3]_1.mp4' 
[  15.576][d][cplayer] Run command: subprocess, flags=64, args=[ffmpeg,-loglevel,panic,-hide_banner,-ss,00:00.000,-i,H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3].mkv,-to,64.3348541661,-map,0:0,-map,0:1,-map,0:2,-c:v,libx264,-profile:v,high,-level,4.2,-pix_fmt,yuv420p,-crf,13,-c:a,libfdk_aac,-b:a,128k,H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3]_1.mp4, no, 0, yes, no]
[  15.695][d][cplayer] Run command: script-binding, flags=73, args=[encode/encode-ENTER]
[  15.831][d][cplayer] Run command: show-text, flags=64, args=[Failed to encode, check the log, -1, 0]

log.txt

@Naomi010Sentzke
Copy link
Author

Naomi010Sentzke commented Sep 24, 2019

I went ahead and ran mpv through Command Prompt and got this

VO: [gpu] 1920x1080 yuv420p10
AO: [wasapi] 48000Hz stereo 2ch s16
AV: 00:01:03 / 00:24:32 (4%) A-V:  0.000
[encode] ffmpeg -ss 00:00.000 -i 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3].mkv' -to 63.7098541661 -map 0:0 -map 0:1 -map 0:2 -c:v libx264 -profile:v high -level 4.2 -pix_fmt yuv420p -crf 13 -c:a libfdk_aac -b:a 128k 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3]_1.mp4'
(Paused) AV: 00:01:04 / 00:24:32 (4%) A-V:  0.000

Exiting... (Quit)

@occivink
Copy link
Owner

Ah sorry that's kind of silly of me, I forgot I have all output from ffmpeg disabled, I need to revise this. What if you run the ffmpeg command directly in the command-line?

 ffmpeg -ss 00:00.000 -i 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3].mkv' -to 63.7098541661 -map 0:0 -map 0:1 -map 0:2 -c:v libx264 -profile:v high -level 4.2 -pix_fmt yuv420p -crf 13 -c:a libfdk_aac -b:a 128k 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3]_1.mp4'

@Naomi010Sentzke
Copy link
Author

Naomi010Sentzke commented Sep 24, 2019

So, Zeranoe's ffmpeg build does not come with --enable-libfdk-aac. So, I went with the native aac encoder
ffmpeg -ss 00:00.000 -i 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3].mkv' -to 63.7098541661 -map 0:0 -map 0:1 -map 0:2 -c:v libx264 -profile:v high -level 4.2 -pix_fmt yuv420p -crf 13 -c:a aac -b:a 128k 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3]_1.mp4' and got this error

Automatic encoder selection failed for output stream #0:2. Default encoder for format mp4 (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:2

So, I went with this by removing the map arguments
ffmpeg -ss 00:00.000 -i 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3].mkv' -to 63.7098541661 -c:v libx264 -profile:v high -level 4.2 -pix_fmt yuv420p -crf 13 -c:a aac -b:a 128k 'H:\Anime\Log Horizon 2\[SallySubs] Log Horizon 2 - 01 [BD 1080p FLAC] [2D5E1BC3]_1.mp4'
But it does not contain the subs. I want ffmpeg to hardsub the subs. For that you need to pass "-vf subtitles=filename.mkv" to ffmpeg. After lots of compromises, this is my new config.

only_active_tracks=yes
preserve_filters=yes
append_filter=
codec= -c:v libx264 -profile:v main -level 4 -pix_fmt yuv420p -crf 15 -c:a libopus -b:a 160k
output_format=$f_$n.mkv
output_directory=
detached=yes
ffmpeg_command=ffmpeg
print=yes

Now, heres a new issue. I wanted to put output_format=$f_$s_$e_$n.$x, but it wont accept that.

occivink pushed a commit that referenced this issue Sep 25, 2019
@occivink
Copy link
Owner

Oh I never realized but : is not accepted in filenames on windows so $s and $e have never worked there. Should be fixed now.

Regarding vf=subtitles, I think I will add a specific parameter for this, since it's currently not easy/possible to do with the existing ones.

occivink added a commit that referenced this issue Sep 25, 2019
WANDEX pushed a commit to WANDEX/mpv-scripts-occivink that referenced this issue Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants