H.265 Videos Not Playing in VLC or SMPLayer or Videos

Ffmpeg works really well for transcoding and you can give it options as to the format to use. I simply allowed it to do the default ffmpeg -i file.MOV file.mkv and it used h264 as the output. Very easy though to select different if desired.

I will note that it read the input very slowly ( ~ 0.1 to 0.3 x) rate while working.

1 Like

Thank you for the elaboration.

Hmmm… well it might be that the “best” solution is boot in to Win 10 (which plays those hevc files fluidly), then use either ffmpeg or the transcode function of DaVinci Resolve to transcode them, and then boot back in to Fedora once they have all been transcoded.

Not my preffered work flow, but certainly doable.

Thank you for the code.

mark_fenovo@fedora ~]$ sudo dnf repolist
[sudo] password for mark_fenovo: 
repo id                        repo name
fedora                         Fedora 36 - x86_64
fedora-cisco-openh264          Fedora 36 openh264 (From Cisco) - x86_64
fedora-modular                 Fedora Modular 36 - x86_64
google-chrome                  google-chrome
phracek-PyCharm                Copr repo for PyCharm owned by phracek
rpmfusion-free                 RPM Fusion for Fedora 36 - Free
rpmfusion-free-updates         RPM Fusion for Fedora 36 - Free - Updates
rpmfusion-nonfree              RPM Fusion for Fedora 36 - Nonfree
rpmfusion-nonfree-steam        RPM Fusion for Fedora 36 - Nonfree - Steam
rpmfusion-nonfree-updates      RPM Fusion for Fedora 36 - Nonfree - Updates
updates                        Fedora 36 - x86_64 - Updates
updates-modular                Fedora Modular 36 - x86_64 - Updates

That would seem counter-productive to me.
Using ffmpeg in linux with a script could handle it seamlessly instead of moving things back and forth. A simple script could set things up for your preferences then the coding could happen in the background while doing other things.

Flow could be download → process → listen/watch the result.

ffmpeg -i file.mkv -codec copy file.mp4

ffmpeg -i file.mkv file.mp4

q 1. do the above 2 commands do the exact same thing?

q 2. if yes then which of the 2 commands should be ideally used / is preferable?

Q1 No they do not. Command 1 copys only with change of container from mkv to mp4 format.
Command 2 allows ffmpeg to select a default codec to transcode and may or may not actually change the encoding.
The file named P1460938.mkv with size 7848128
was converted to P1460938b.mp4 with size 7857700 using command 1
and converted to P1460938a.mp4 with size 7339654 using command 2.
As you can see by the size alone the commands do not do the same thing.

I usually am going from mp4 to mkv so had not previously tested the output from command 2 and almost never use command 1.

Q2. The user makes the choice depending upon preferences.

You can easily make these tests yourself to decide which is better for your needs.

1 Like

Just to add to this.
The original MOV file is more than 20 times the size of the mkv (or mp4) file.

-rw-rw-r--. 1 USER USER   7848128 Jul 20 11:36  P1460938.mkv
-rw-rw-r--. 1 USER USER 183154840 Jul 20 09:39  P1460938.MOV
-rw-rw-r--. 1 USER USER   7884793 Jul 20 14:20  P1460938.mp4

I must be not understanding something here (not a surprise)

When I check the properties in Gnome Files, it says the size is 376.9MB

I downloaded the file you linked with wget. Don’t know how you did it, but seems strange yours would be twice the size if we actually got the same file.

In fact I just downloaded it again in case there was something wrong on my end and it was exactly the same size. 183154840 bytes.

Hmmm…

I am logged in to windows now and in win 10 file explorer it says 178,863 KB so either I am loosing my mind or I am going crazy.

183154840 bytes = 178863 KB
Divide by 1024 :wink:

1 Like

The video is encoded with HEVC, 10-bit color, 4k@59.94fps, so it’s pretty taxing to most CPUs. For example, my Intel i5-1145G7 CPU can’t play it smoothly, but the built-in Intel Iris Xe GPU can (via VA-API hardware acceleration). I’d say it should be expected for this particular video doesn’t play smoothly without hardware accelerated decoding. For nVidia GPU, try mpv --hwdec=nvdec. On Intel (and AMD), use mpv --hwdec=vaapi.

2 Likes

Thank You :slight_smile:

First, Thank you for the reply. It looks like you are correct. There needs to be some hardware acceleration for it to play.

I tried playing the file on Windows with task manager monitoring GPU useage and indeed, video decode jumps to 70% for my RTX 2060 when I simply play the video file with the built-in Windows Movie and TV App.

So yes, in windows the GPU is handling the decoding.

Now, can you tell me HOW I would try mpv --hwdec=nvdec?

I am not sure if it is a driver, or a library? Is it a line of text I put in a configuration file somewhere?

Sorry but I am still very much a noob.

Thanks in advance.

How do you launch mpv? From an icon in the activities menu or from the cli?

If on the cli then simply add what is noted above to your command.

If using the icon then it is likely the actual command is in the file /usr/share/applications/mpv.desktop.

If you copy that file to your local desktop (~/Desktop) then edit it similar to this it should work. There are 2 lines in that file I would modify.

First the Name which probably reads Name=mpv Media Player and should be changed so you know this is the one you are selecting when you hover the mouse over the icon. Maybe to something like this Name=mpv Media Player HW accel (or whatever you wish). The file name can be changed as well if you wish.

Then you would need to modify the Exec line from the default to add your option. The modified line would read Exec=mpv --player-operation-mode=pseudo-gui --hwdec-nvdec -- %U

I do not recommend altering the original file under /usr/share since that was installed by the app and would be removed when the app is uninstalled.

3 Likes

Success!!! Sort of…

When logged in to an Xorg session, MPV plays the file fine.

In Wayland??? Not so much…

In Wayland, the AUDIO plays fine. But the screen is blank.

[mark_fenovo@fedora Videos]$ mpv --hwdec=nvdec P1460928.MOV
 (+) Video --vid=1 (*) (hevc 3840x2160 59.940fps)
 (+) Audio --aid=1 (*) (pcm_s16be 2ch 48000Hz)
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
[vaapi] libva: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
Using hardware decoding (nvdec).
AO: [pulse] 48000Hz stereo 2ch s16
VO: [gpu] 3840x2160 cuda[p010]
AV: 00:00:00 / 00:00:15 (4%) A-V:  0.003 Dropped: 1

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

AV: 00:00:00 / 00:00:15 (5%) A-V:  4.998 Dropped: 6
[lavf] Too many packets in the demuxer packet queues:
[lavf]   video/0: 390 packets, 157599904 bytes
[lavf]   audio/1: 0 packets, 0 bytes
AV: 00:00:07 / 00:00:15 (51%) A-V:  0.001 Dropped: 73
Audio device underrun detected.
AV: 00:00:15 / 00:00:15 (100%) A-V:  0.000 Dropped: 147

Exiting... (End of file)

Hmmm… I am not sure what that means. Since there don’t seem to be any “desktop icons” in Gnome, do you mean if using the launcher (super Key → M → then click mpv which is how I might launch it)?

To be honest, I normally use the contextual menu by right-clicking the video file, then using the “Open with Other Application” dropdown to chose the app.

I guess my main question though is:

Can I set ALL the video applications to use the option --hwdec-nvdec any time they launch globally?

The .desktop file is the what integrates with the launcher (desktop environment). It provides the command to run and the icon representing the program etc…
For mpv it is mpv.desktop.

you can copy that file to ~/.local/share/applications, open it with your editor of choice and modify the exec line as @computersavvy described.

I would also suggest adding gnome-session-inhibit so you don’t get bit by screenblanking. That looks like: Exec=gnome-session-inhibit mpv --player-operation-mode=pseudo-gui -- %U

mpv also uses a configuration file located in ~/.config/mpv/mpv.conf`

The configuration file for your setup would look like :

vo=gpu
hwdec=nvdec

If you have multiple users on the machine and would like to do either of these for all users.
After you get the configuration file working for your user you can copy it to /etc/mpv/
for the desktop file you would want to copy it to /usr/local/share/applications/

If you want to use mpv, i’d strongly suggest checking out, mpv.io

Along those same lines there is another player called celluloid which is more or less a gtk front end for mpv. This can be setup using an mpv config file or just by adding the mpv options to: → Preferences → Miscellaneous → Extra MPV Options

I did find that this stuttered a bit when opening the file but would play smooth the second time.

The above covers mpv, for VLC under input/Codecs there should be a selection for Hardware accelerated decoding. I think it defaults to automatic, you may want to try swapping to VDPAU and seeing how that works.

2 Likes

That is it.

1 Like

Thank you very much for the detailed reply. You have given me a lot to digest here (I am still relatively new to “tinkering” in Linux, despite the fact that I have been using Linux Mint on several computers for years now.)

I will post updates (hopefully) later today, but I am out at work most of the day. I just don’t want you to feel like you took the time to write out how to do something and it got ignored.

Thanks again.

1 Like