This forum is deprecated. Please visit https://github.com/smplayer-dev/smplayer/discussions

Force h264 for YT

Problems, bugs, suggestions... anything related to SMPlayer.

Force h264 for YT

Postby 100% » Sun Jun 28, 2020 10:26 am

Hey guys, is there a way now to force YouTube videos to stream only in h264 format?

Thank you.
100%
 
Posts: 11
Joined: Sat Jul 02, 2016 1:14 pm

Re: Force h264 for YT

Postby agent20 » Tue Jul 14, 2020 1:23 pm

The h264 codec is used only by mp4 videos. The corresponding audio is aac (m4a). The webm videos use a different codec.

The Youtube 'best' format only uses mp4. You will never find a webm video in the 'best' format. So, in 'Network - Youtube(and other sites)- Support for video sites', if you choose mpv + youtube-dl, then 'best' in 'Preferred Quality', you are guaranteed to get only mp4 videos with the h264 codec.

The disadvantage is that the highest resolution for 'best' videos is Format 22 (1280x720) and usually in music videos it is as low as Format 18 (640x360).

If you prefer higher resolutions with mp4, still use mpv= youtube-dl, but you need to override the 'preferred quality' by going to Advanced - Mplayer/mpv and in Options, then paste
--ytdl-format=bestvideo[ext=mp4]+bestaudio[ext=m4a]/best

Obviously, then click 'Apply'.

By way of an explanation, if you simply select "Best video and audio" in Preferred Quality, you will sometimes get webm videos, which do no use the h264 codec. You must override it in the Advanced Options section.

If you want to be more adventurous, there are variations on the code in Options.

For instance, you can force the player to use Format 22 by default (that is mp4 (1280x720) and, if that does not exist, it will select a mp4 video of a higher DASH resolution. You can also limit the resolution size and frame rate. For example, this code will do those things.

--ytdl-format=22/bestvideo[ext=mp4][height<=1080][fps<=?30]+bestaudio[ext=m4a]/best


By the way, you cannot get k2 or k4 videos with mp4. Those resolutions only use webm.

If anyone else can give you an easier way, no doubt you will hear from them.

This is the first time that I have posted here and I had to go to the trouble of registering to answer your request. So, I hope that this is helpful to a degree.
agent20
 
Posts: 2
Joined: Tue Jul 14, 2020 1:20 pm


Return to General

Who is online

Users browsing this forum: No registered users and 8 guests

cron