gkreidl
Posts: 6120
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Tue Mar 26, 2019 9:35 am

RPi_Mike wrote:
Tue Mar 26, 2019 12:07 am
....
Finally, keep in mind that both the RPi 3 and Pi Zero only provide GPU hardware support for H.264-based video (without getting into optional license purchasing or firmware modifications).
I've already told you that this isn't true.
By default, the GPU also supports H263 (the old xvid & divx formats) besides H264/MPEG-4-AVC.
You can get additional GPU support for VP6, VP8, MJPEG and THEORA by enabling the extended firmware in /boot/config.txt. This is not a "firmware modification". It has been an option for a long time and is part of the standard distribution.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Tue Mar 26, 2019 11:57 am

gkreidl wrote:
Tue Mar 26, 2019 9:35 am
I've already told you that this isn't true.

NOTE TO OTHER READERS: While discussing a totally unrelated topic — modifying my script for use on a Pi Zero — I failed to add the tiresome qualifier "among modern codecs in common use today".

This created an irresistible "gotcha" opportunity for Günter and he took it!

I can't say I'm surprised, however — several months ago, he mistakenly tried to correct me on another matter and it backfired badly on him, so he's probably been itching for a chance to get back at me the whole time.

oppfields
Posts: 2
Joined: Thu Apr 25, 2019 12:18 am

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Thu Apr 25, 2019 12:46 am

Hi RPi_Mike,

Thanks for your work on this script, the instructions easy to follow and prompted you double check the basics before commuting. Everything went smoothly for me. Playback is good even with badly encoded files with no video PTS, properly encoded 1080 files are playing perfectly. I've yet to test everything fully and work through the appendices but on initial tests I'm very happy.

My requirement is to have a headless player so I've installed udevil to help with auto mounting USB flash drives and triggering looped playback. A combination of your work and udevil will solve all the issues I've had with other video loopers not working reliably or not being supported on the Raspberry Pi 3 B+.

Thanks again for the time you've dedicated to the script.

Now playing The Fifth Element (1997) with subtitles from srt file :-)

Raspberry Pi 3 B+
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.8 (stretch)
Release: 9.8
Codename: stretch

segalion
Posts: 17
Joined: Wed Apr 24, 2013 1:42 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Wed May 08, 2019 11:33 am

Hello. I was trying your build script, but I have debian lite version (with lot of other stuff...) so build process fails a lot...

Could you (or any) post the .deb binaries somewhere? I am almost sure it works fine in more than 95% of stretch raspbians.

Thanks

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Fri May 10, 2019 9:23 pm

segalion wrote:
Wed May 08, 2019 11:33 am
I was trying your build script, but I have debian lite version (with lot of other stuff...) so build process fails a lot...

While discussing the high-quality work I've done, it's extraordinary that someone would use a disparaging word like "fail" when it doesn't even apply!

Lawyers have a fancy term for this — it's called "false implicature". It's like saying "Stephen Hawking was innocent of murder". The sick thing is that in a purely literal sense, the statement is true. But in terms of psychological impact on most humans, the statement is utterly false — because it falsely "implicates" Hawking with murder — that he was plausibly accused of killing someone! It even raises the possibility that he actually murdered someone — but somehow got away with it when a non-existent jury wrongly found him "innocent"!

So to say my script "fails" on Raspbian Lite (or Debian Lite, as you mistakenly put it) is no more appropriate than to say my script "fails" on the Commodore 64, the BBC Micro, and the Apple iPhone.

As I clearly indicated in my tutorial's requirements section, my script is NOT designed to work on the stripped-down "lite" version of Raspbian!

Given the hard work these things require, it was my extremely rational decision to only support the full Desktop version of Raspbian — not the watered-down "command line" version which was never intended to provide a complete multimedia experience.

But it's not just a compiling issue as you wrongly assume. Even if you had possession of the .deb installer files that my script creates, you still wouldn't be able to get it working. That's because my GPU-accelerated software suite requires a variety of components that are missing in the lite version of Raspbian.

Is it possible — in theory — to get my script and the software it creates to work on Raspbian Lite? Yes, it might be possible — but only if you modify my script in a manner that significantly modifies Raspbian Lite itself. But as I explained, that is a topic I have no interest in exploring.

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Fri May 10, 2019 9:24 pm

oppfields wrote:
Thu Apr 25, 2019 12:46 am
My requirement is to have a headless player so I've installed udevil to help with auto mounting USB flash drives and triggering looped playback. A combination of your work and udevil will solve all the issues I've had with other video loopers not working reliably or not being supported on the Raspberry Pi 3 B+.

Thanks again for the time you've dedicated to the script.

You're welcome!

In order to consolidate everything related to my GPU-accelerated software suite on one thread, I'm also responding to your other post on video looping (which you made on another thread):



oppfields wrote:
Thu Apr 25, 2019 12:53 am
I've been testing video loopers and ended up using the following tutorial:

viewtopic.php?t=199775

If you combine this script with udevil you will end up with a very solid video looper which runs on the Raspberry Pi 3 B+. Note: I have not found any other video playback distributions which work with the Raspberry Pi 3 B+ so the script linked above is your best option.

https://github.com/IgnorantGuru/udevil

I'm glad you found my script — and the GPU-accelerated software suite it creates — to be the "best option" for video looping on the Raspberry!

For other readers that may be interested, you can simply add the "--loop=inf" option to force mpv to play a video, over and over again, for "infinity". This is perfect for digital signage in a waiting room, lobby, trade show or retail display. A simple command line like this will do the job:

mpv --loop=inf video.mp4

I should note that unless you have a need to automatically trigger the playing of a video upon insertion of a USB thumb drive — a very cool but very specific "use case" — you definitely don't need udevil. My custom-built software is sufficient all by itself.

Finally, you can make mpv "auto execute" every time your Raspberry boots up. That way, the simple act of turning your Raspberry on will cause the designated video to automatically start playing — and looping — without any human intervention!

To do that, simply do the following 2 steps:


1: CREATE THIS DESKTOP FILE (by running this command line in Terminal):

leafpad /home/pi/.config/autostart/video-at-boot.desktop


2: PLACE THESE 3 LINES INSIDE THE DESKTOP FILE AND SAVE IT:

[Desktop Entry]
Type=Application
Exec=lxterminal -e bash -c "sleep 5; mpv --loop=inf \"/home/pi/Videos/Vacation Video.mp4\""


NOTE #1: In the above example, I'm using a file path to a video called "Vacation Video.mp4". You will obviously need to change that to suit your needs.

NOTE #2: By invoking "bash -c" in addition to "lxterminal -e" in the above .desktop file, I'm able to issue MULTIPLE commands separated by a semicolon. This trick I discovered — which gets around the annoying single-command limitation of LXTerminal — allows me to place a "mini-script" directly inside a .desktop file — thus avoiding the added complexity of having to point to a separate script file!

NOTE #3: The "escaping" I did with the back slashes before the "internal quotes" is necessary to support space characters in the file name or path. This back slash "escaping" requirement has nothing to do with mpv — it's related to the specifics of this particular situation – that we're feeding a quoted list of multiple commands to Bash that also happens to contain internal quoting. And yes, that's 2 double-quotes in a row at the end of the "Exec=" line.

NOTE #4: The "sleep 5" command is designed to give your system adequate time to "settle down" (after booting) before mpv is triggered to play the video. In my case, I found 5 seconds was quite sufficient — but it's possible that your particular system might require more time in order to avoid problems. For example, you might instead be using your system to boot and automatically play a live stream, in which case you'll want to provide a longer delay to give the Raspberry adequate time to establish an Internet connection.

NOTE #5: X Window (X11) applications — such as LXTerminal, which mpv requires in order to provide keyboard control of the video — will generally not work if they are started from the /etc/rc.local file (the other common method people use to start commands or scripts upon boot). That's because the X Window System is typically not running at that stage of the boot-up process. Hence my use of the .desktop file approach in this particular case.

NOTE #6: For the "auto-launch during boot" technique to work, Raspbian Desktop needs to be set to "auto login" as user pi, with booting set to the Desktop (not the CLI). These are the operating system's default settings — so you don't need to do anything unless you altered those items. The settings can be checked at Raspberry Menu | Preferences | Raspberry Pi Configuration | System Tab.

NOTE #7: My GPU-accelerated software suite requires Raspbian Desktop — it is NOT designed to work on the stripped-down "lite" version of Raspbian!

segalion
Posts: 17
Joined: Wed Apr 24, 2013 1:42 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Mon May 13, 2019 11:31 am

RPi_Mike wrote:
Fri May 10, 2019 9:23 pm
While discussing the high-quality work I've done, it's extraordinary that someone would use a disparaging word like "fail" when it doesn't even apply!
Sorry about my post. I dont want incomodate you and I apreciate your great work. I have use 'fail' not despectively, only to say why I was asking for binaries (because it was not easy for me get proper enviroment to run your building script).

Finally I was able to make all necesary in my little 4GB raspbian-lite to build it, and now It is working fine.

Im going to try to build ffmpeg with 'enable-shared' and mpv with 'libmpv-shared' in order to use https://github.com/jaseg/python-mpv, that is what I really would test.

Thanks again.

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Mon May 13, 2019 10:28 pm

segalion wrote:
Mon May 13, 2019 11:31 am
Sorry about my post. I dont want incomodate you and I apreciate your great work. I have use 'fail' not despectively, only to say why I was asking for binaries

It is what it is. Good luck with your experiments.

DaveN003
Posts: 1
Joined: Tue May 21, 2019 12:52 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Tue May 21, 2019 1:01 pm

Hi. I realise that my setup isn't exactly what you specify (& I understand your reasons) but I wondered whether you might be able to give me a pointer as to the problem I'm having. IE running ffprobe (for example) terminates with 'illegal instruction'. The real difference in my setup is that I'm using the 'stretch' version of rpi which is a 3B.
I was wondering if it was due to the cflags including armv8 stuff (whereas the 3B is armv7)? Otherwise do you have any pointers please?

I'm basically trying to display IP camera video on my TV connected via an HDMI port. I'd be really grateful for a command line example of how to use ffmpeg/mpv in this scenario to maximise throughput.

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Wed May 22, 2019 5:02 am

DaveN003 wrote:
Tue May 21, 2019 1:01 pm
I realise that my setup isn't exactly what you specify..... I'm using the 'stretch' version of rpi which is a 3B. I was wondering if it was due to the cflags including armv8 stuff (whereas the 3B is armv7)?

I'm basically trying to display IP camera video on my TV connected via an HDMI port.

To be honest, you seem to be confusing hardware with software.

There's no such thing as the "Stretch version" of the Raspberry Pi.

The Raspberry is a piece of hardware — a computer in the form of a small circuit board. Over the years, there have been various versions and sub-versions of the Raspberry hardware — such as the "1", "2", and "3".

Stretch is the codename for the software operating system that runs on the Raspberry. Its full name is Raspbian Stretch. A few years ago, the operating system was called Raspbian Jessie. And sometime later this year, the next major version should be coming out — Raspbian Buster. All of it is based on the well-established Linux distribution known as Debian.

Your question about CPU optimizations strikes me as absurdly technical, given your prior comment about the kind of Raspberry you think you have. All you need to know is that it's a complicated subject that has absolutely nothing to do with your issue (whatever your issue really is).

More importantly, what you said is not even true — BOTH the Raspberry Pi 3B and 3B+ are based on the Cortex-A53 processor, which fully supports the ARMv8-A 64-bit instruction set. Now, in practice, does that mean users of Raspbian have access to those features? No, it does not. That's because the operating system is the "middle man" between you and the processor. For example, Raspbian Stretch is a 32-bit operating system — so 64-bit software won't even run on it. And most optimizations that actually work on Raspbian typically use ARMv6. The GCC compiler does a good job at dropping down to the "best available" optimizations for FFmpeg and x264, even if a higher one is selected in the compile flags.

Finally, mpv should work fine with any standard IP camera. To borrow an example from mpv's GitHub site, a command line like the following will play live video — although the exact format of the URL will vary, depending on what company made your IP camera — so check the manufacturer's website for details:

mpv rtsp://user:[email protected]/onvif1

Some users apparently found they had to put the URL inside double quotes. And another user found that for his particular camera, he had to add "--rtsp-transport=udp" or "--rtsp-transport=lavf" to the command line. It all depends on the make and model of your camera.

But before you try any of that, there's a giant elephant in the room that needs to be addressed:

I strongly suspect that your system is MESSED UP! You said yourself that your "setup isn't exactly what (I) specify". Well, guess what? Compiling more than a million lines of code requires TOTAL EXACTITUDE. So my advice to you is to follow my instructions TO THE LETTER — and that means, above all, that you start with a completely "normal", unaltered, fully-standard copy of the Desktop version of Raspbian Stretch. The best way to do that is to begin with a freshly-burned SD card with the latest version of Raspbian. It's available in the Downloads section of this website.

jordiblanchcarles
Posts: 8
Joined: Wed Feb 14, 2018 6:27 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Thu May 30, 2019 12:16 pm

Hello!

I've built and installed your mpv on a fresh Raspbian intallation (latest Raspbian image available) and it works perfectly when the screen is configured in landscape mode (display_hdmi_rotate=0 or display_hdmi_rotate=2 in /boot/config.txt file). But when the screen is configured in portrait mode (display_hdmi_rotate=1 or display_hdmi_rotate=3 in /boot/config.txt file), then there are some MMAL errors and many dropped frames. I've tried with the Neutron_Stars_Colliding_1080p.mp4 video and some other fullHD videos and with most of them there's this problem, and even some of them are freezing mpv so that it never ends (I have to kill mpv to end it).

Do you think this problem is something related to your building configuration? Do you have any clues on how to solve this problem?

Here it is the mpv output when playing Neutron_Stars_Colliding_1080p.mp4 file with display_hdmi_rotate=1 in /boot/config.txt file.

[email protected]:~ $ mpv Neutron_Stars_Colliding_1080p.mp4
Playing: Neutron_Stars_Colliding_1080p.mp4
(+) Video --vid=1 (*) (h264 1920x1080 29.970fps)
(+) Audio --aid=1 (*) (aac 2ch 44100Hz)
Using hardware decoding (mmal).
VO: [rpi] 1920x1080 mmal
AO: [alsa] 44100Hz stereo 2ch float
AV: 00:00:04 / 00:00:42 (9%) A-V: 0.000 Dropped: 13
[ffmpeg/video] h264_mmal: Did not get output frame from MMAL.
Error while decoding frame!
AV: 00:00:09 / 00:00:42 (21%) A-V: 0.000 Dropped: 40
[ffmpeg/video] h264_mmal: Did not get output frame from MMAL.
Error while decoding frame!
AV: 00:00:19 / 00:00:42 (45%) A-V: 0.000 Dropped: 94
[ffmpeg/video] h264_mmal: Did not get output frame from MMAL.
Error while decoding frame!
AV: 00:00:36 / 00:00:42 (85%) A-V: 0.008 Dropped: 194
[ffmpeg/video] h264_mmal: Did not get output frame from MMAL.
Error while decoding frame!
AV: 00:00:42 / 00:00:42 (99%) A-V: 0.000 Dropped: 231


Exiting... (End of file)


Thank you!

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Thu Jun 06, 2019 8:58 pm

jordiblanchcarles wrote:
Thu May 30, 2019 12:16 pm
I've built and installed your mpv on a fresh Raspbian intallation (latest Raspbian image available) and it works perfectly.....

Awesome!

I'm glad we got that on the record — that my GPU-accelerated build of mpv works perfectly!



jordiblanchcarles wrote:
Thu May 30, 2019 12:16 pm
But when the screen is configured in portrait mode (display_hdmi_rotate=1 or display_hdmi_rotate=3 in /boot/config.txt file), then there are some MMAL errors and many dropped frames..... Do you think this problem is something related to your building configuration? Do you have any clues on how to solve this problem?

What you're describing is definitely NOT related to any "problem" with my build of mpv.

In fact, since you've altered the Raspberry's fundamental boot settings, you're no longer using a completely "normal", standard copy of Raspbian. Instead — from my perspective — you're using a different operating system that I refer to as Altered Raspbian!

In fact, I previously published a philosophical statement on this very topic that you might like to read. It's marked in red at the bottom of this post:

viewtopic.php?f=38&t=228095#p1437891

Since I make very clear in my tutorial that you must have a truly "normal" and standard system, the issue you're describing is therefore off-topic.

But I'll address it anyway:

When you alter the default boot settings like that, you're no longer using a standard 1920 x 1080 display in any practical sense.

Instead, in effect, you're using a completely opposite display — a 1080 x 1920 display! The entire display is being electronically rotated 90 degrees. In fact, this also means that the hardware of your screen must be physically rotated as well!

In plain English, therefore, you're essentially asking me why my GPU-accelerated build of mpv doesn't behave as you want it to when it's forced to perform SIDEWAYS!

When it comes to state-of-the-art media players that support the Raspberry's GPU, my only "competitor" is the Raspberry Pi Foundation itself — which released a GPU build of VLC, 11 months after my mpv contribution.

So just out of curiosity, I tested both mpv and VLC in full-screen mode on a 1080p video — on a 1080p monitor with a "sideways" display (otherwise known as "portrait mode"; display_hdmi_rotate=1).

In full-screen mode, VLC treated the screen as if it were 1920 pixels wide. Unfortunately, because the screen is only 1080 pixels wide in a sideways orientation, almost half the video was cut off and completely disappeared past the edge of the screen. So VLC did not properly resize the video to fit the screen. It also dropped a significant number of frames.

In contrast, my build of mpv displayed all of the video correctly in full-screen mode. But exactly as you described, it dropped a significant number of frames.

At the 30,000 foot level, all of this makes perfect sense:

When you're forcing your system to play a high-definition video that's nearly 2,000 pixels wide on a screen that's only about 1,000 pixels wide, you're forcing it to continuously interpolate the entire video and downscale it to a much smaller size to fit on a much smaller piece of real estate.

Crunching more than 62 MILLION full-color pixels per second — 1920 x 1080 x 30 FPS — is very computationally demanding for a $35 computer!

I noticed, however, that my build handles 480p videos perfectly on a "sideways" screen! In other words, 854 x 480 videos work extremely well when the screen is acting as a "sideways" 1080 x 1920 display.

This is actually a pretty big deal for those interested in using a sideways screen — for one simple reason: If you have access to the same video in 480p, there's no real purpose in using a 1080p video anyway!

That's because the screen is only going to show you less than 1/3 of the pixels anyway — because both the horizontal AND vertical pixel count are being cut roughly in half! That's just a law of geometry when you rotate a 1080p screen 90 degrees while maintaining the proper 16:9 aspect ratio on a 1080p video — you automatically lose more than 2/3 of all the displayed pixels!

[For those that are curious, the pixel count drops from about 2.1 megapixels to only 657 kilopixels! That means the pixel count is dropping by a gigantic factor of almost 3.2!]

So the bottom line is that a "sideways" display of a 1920 x 1080 video on a 1080 x 1920 screen — in other words, a 1080p display in portrait mode rather than landscape mode — will cause the video to shrink down to only 1080 x 608. So a 1080p video instantly becomes a much smaller "608p" video! And 608p is a fairly minor improvement in resolution over a 480p video — especially in terms of what the human eye can discern. That's why, in a sideways scenario, there's no big advantage to using a 1080p video in the first place!

Even highly-advanced aliens would not be able to get around this basic issue — because it's a fundamental feature of Euclidean geometry! OK, fine — maybe aliens could instantly increase the number of physical pixels inside the screen whenever you turn it sideways. But no, even that wouldn't apply to what I'm saying — because then it would no longer be a true 1080p display!

At any rate, switching to 480p videos — and using my build of mpv — provides a great solution for a sideways display. Of course, in some cases, you may not have access to the same 1080p video in 480p — and there's absolutely nothing you can do about that (other than re-encoding the original video and resizing it down to 480p. My build of FFmpeg, by the way, is very well-suited to that task).

But in many cases, such as streaming YouTube videos, using 480p content on a sideways screen is a great solution — because most videos on YouTube are also available in 480p! So if you want to change the default streaming configuration for mpv — so that it never streams videos bigger than 480p on your sideways screen — just run this command in Terminal:

leafpad /home/pi/.config/mpv

And simply change:

THIS:

bestvideo[height<=?1080]

TO THIS:

bestvideo[height<=?480]

So there ya go — I hope this helps. Good luck on your "sideways" experiments!

jordiblanchcarles
Posts: 8
Joined: Wed Feb 14, 2018 6:27 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Sun Jun 09, 2019 10:12 am

Hello,

I've done some more tests, and rotating the video using the mpv --video-rotate flag is working properly. So for example, a FullHD video with 1920x1080 pixels will not give any mmal error and it will not loose frames when using the --video-rotate flag to be shown on a portrait screen (so forcing mpv to scale down the video to fit the screen size of 1080x1920). Also, using the --geometry flag, you can scale up/down and position the video and it won't loose any frames nor give any mmal error, so in my opinion, the problem I described when the Raspberry Pi is configured in portrait mode (display_hdmi_rotate=1 or display_hdmi_rotate=3 in /boot/config.txt file) is not due to the Raspberry Pi not being powerful enough to rescale so many pixels or whatever, but to something else related with the way that Raspberry Pi hardware/software handles the screen rotation itself.

I've also used omxplayer to test whether it is playing any FullHD landscape video when Raspberry Pi is configured in portrait mode and, although I cannot be 100% sure that it is also having problems and loosing frames because this information is not given at the omxplayer output in shell, my impression when looking at the video when playing is that omxplayer is also loosing some frames and the video is not playing as smooth as when the Raspberry Pi is configured in landscape mode.

So, my conclusion is that, configuring the Raspberry Pi in portrait mode will throw some problems when playing videos, so that if this is really needed, the best solution is using the --video-rotate flag (and the --geometry flag if needed) to show the video in a protrait screen instead of configuring the Raspberry Pi itself to portrait mode.

Best regards!

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Sun Jun 09, 2019 7:33 pm

jordiblanchcarles wrote:
Sun Jun 09, 2019 10:12 am
I've done some more tests, and rotating the video using the mpv --video-rotate flag is working properly.

I'm glad to hear my build of mpv is still performing flawlessly — even when forced to play a video at a 90-degree angle!




jordiblanchcarles wrote:
Sun Jun 09, 2019 10:12 am
I've done some more tests, and rotating the video using the mpv --video-rotate flag is working properly. So for example, a FullHD video with 1920x1080 pixels will not give any mmal error and it will not loose frames when using the --video-rotate flag to be shown on a portrait screen (so forcing mpv to scale down the video to fit the screen size of 1080x1920).

NOTE TO OTHER READERS: Don't let this person's reference to "portrait screen" cause any confusion! In these two sentences, he's NOT referring to "portrait mode" for the operating system. Instead, he's referring to standard landscape mode — while physically rotating the entire screen to place it in a "portrait orientation"! So the screen, from an operating system perspective, is NOT "1080 x 1920". It's still just a standard 1920 x 1080 screen in landscape mode. Nonetheless, I'm glad my build of mpv, in rotate mode, performs flawlessly under these conditions!




jordiblanchcarles wrote:
Sun Jun 09, 2019 10:12 am
so in my opinion, the problem I described when the Raspberry Pi is configured in portrait mode (display_hdmi_rotate=1 or display_hdmi_rotate=3 in /boot/config.txt file) is not due to the Raspberry Pi not being powerful enough to rescale so many pixels or whatever, but to something else related with the way that Raspberry Pi hardware/software handles the screen rotation itself.

Your speculation and mine are NOT mutually exclusive!

That's why I was careful to preface all my comments by saying "at the 30,000 foot level".

By keeping things at the 30,000 foot level, I was deliberately not getting into the extreme detail of whether Raspbian's "portrait mode" has been fully optimized for the GPU. You and I are not privy to the secrets of the VideoCore IV GPU — and exactly how the operating system interacts with it.

You also need to keep in mind that portrait mode is NOT the standard, default configuration of Raspbian — it's essentially an experimental boot option that people can use at their own risk.

In fact, you're the only person to ask about this in more than 83,000 views of my tutorial — enough to fill all the seats in some of the world's largest football stadiums.

It's all academic anyway — but at least when it comes to my build of mpv in portrait mode, it appears that additional hardware horsepower, by itself, might very well be sufficient to get it running smoothly with no dropped frames. Unlike VLC, it properly scales and centers 1080p videos in portrait mode.

Does that mean our observations are contradictory as you clearly suggest? No, it does not. That's because there are two potential ways to improve performance in this case — optimizing the operating system's handling of portrait mode or more hardware horsepower. So what you suggest is a false choice — that it has to be one explanation OR the other. Both can be true!

But like I said — it's all academic anyway. Realistically, without getting into even more experimental things like overclocking or modifying the operating system's handling of portrait mode, there's not much you can do about either one.

Nonetheless, I'm glad you got perfect results by keeping the operating system in standard landscape mode and using the 90-degree rotate option within my build of mpv.

Oh, and even though you launched right into your latest post without expressing any thanks for all the time and attention I gave your off-topic question, I'll say "you're welcome" anyway! Remember, all of this is FREE — I'm not charging a single penny for my considerable services!

jonny789
Posts: 54
Joined: Tue May 14, 2013 2:34 pm
Location: Near My Raspberry Pi

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Fri Jun 14, 2019 6:02 am

Hi,
When I install pre-compiled debian packages (which were compiled on raspberry pi 3 having latest raspbian) on freshly installed raspbian on raspberry pi 3 following Appendix 8 from viewtopic.php?f=38&t=199775&p=1360263#p1360263 . I get these errors while running ffmpeg and mpv ::

Code: Select all

ffmpeg: error while loading shared libraries: libXv.so.1: cannot open shared object file: No such file or directory
mpv: error while loading shared libraries: libXv.so.1: cannot open shared object file: No such file or directory
So , I had to do the building and compilation process all over again. Could you tell me what I am doing wrong ?

Thanks.

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Sun Jun 16, 2019 3:59 am

jonny789 wrote:
Fri Jun 14, 2019 6:02 am
When I install pre-compiled debian packages (which were compiled on raspberry pi 3 having latest raspbian) on freshly installed raspbian on raspberry pi 3 following Appendix 8 from viewtopic.php?f=38&t=199775&p=1360263#p1360263 . I get these errors while running ffmpeg and mpv..... Could you tell me what I am doing wrong ?

NOTE TO OTHER READERS:
Though not explicitly stated, it's pretty clear from this person's post that my building script did its job correctly — it automatically created pre-compiled Debian packages for FFmpeg, mpv and the rest of my GPU-accelerated software suite. If it hadn't worked, he never would have gotten the packages in the first place! But apparently, when attempting to install those packages on ANOTHER Raspberry, he encountered problems.

SHORT ANSWER:
You accidentally skipped one or more of the steps in my instructions at Appendix 8. Simple as that!

LONG ANSWER:
I'm obviously not sitting here continuously monitoring all the obscure changes to the Linux kernel — and whatever updates the Raspberry Pi Foundation is constantly issuing for the overall operating system.

Therefore, the theoretical possibility always exists that one of these changes could suddenly "break" my building script or the software it generates. This is not unique to my code — it's true for everyone! It's never happened in the 18 months I've been supporting my tutorial — but it is a possibility.

I therefore took the time — earlier today — to conduct the ultimate "gold standard" test of my own work:

I burned a brand-new copy of Raspbian Stretch Desktop. I then pretended to be a total beginner and followed my own instructions on installing the pre-made packages. In fact, I used your link to my own instructions — because it was the easiest way to get to my own words!

Guess what?

Everything worked perfectly!

So, since you're getting library-related error messages, you probably got distracted and accidentally skipped over step 3 (which installs the libraries and other dependencies) and/or you skipped over "sudo ldconfig" in step 6 (which establishes the links to the shared libraries). Either mistake could easily explain the type of error you report.

There's also the general possibility that your system is not quite as "freshly installed" as you suggest. I once had a person claim they had a brand-new copy of Raspbian — and in their mind, it probably was "brand new"! There was just one giant problem with their claim: They conveniently left out the critical detail that right after their "fresh install", they had tinkered with the Raspberry's fundamental boot settings and switched the system to an experimental OpenGL video driver — which my instructions specifically said NOT to do!

This is not related to your particular problem, but the moral of the story is timeless:

Once someone has "played around" with their system — as far as I'm concerned — it's no longer a "fresh" install. For more on this subject, please see my philosophical statement at the bottom of this post:

viewtopic.php?f=38&t=228095#p1437891

Whatever the case, the specifics of what you may or may not have done are not particularly relevant for one simple reason:

As long as you follow my instructions TO THE LETTER, everything works perfectly. I personally confirmed this fact just a few hours ago!

jonny789
Posts: 54
Joined: Tue May 14, 2013 2:34 pm
Location: Near My Raspberry Pi

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Sun Jun 16, 2019 3:25 pm

RPi_Mike wrote:
Sun Jun 16, 2019 3:59 am
jonny789 wrote:
Fri Jun 14, 2019 6:02 am
When I install pre-compiled debian packages (which were compiled on raspberry pi 3 having latest raspbian) on freshly installed raspbian on raspberry pi 3 following Appendix 8 from viewtopic.php?f=38&t=199775&p=1360263#p1360263 . I get these errors while running ffmpeg and mpv..... Could you tell me what I am doing wrong ?

NOTE TO OTHER READERS:
Though not explicitly stated, it's pretty clear from this person's post that my building script did its job correctly — it automatically created pre-compiled Debian packages for FFmpeg, mpv and the rest of my GPU-accelerated software suite. If it hadn't worked, he never would have gotten the packages in the first place! But apparently, when attempting to install those packages on ANOTHER Raspberry, he encountered problems.

SHORT ANSWER:
You accidentally skipped one or more of the steps in my instructions at Appendix 8. Simple as that!


As long as you follow my instructions TO THE LETTER, everything works perfectly. I personally confirmed this fact just a few hours ago!
Thanks a lot for your guidance and help. You were right. I missed the step 3 of Appendix 8 entirely. I had not installed the dependency packages first. After installing those dependencies , mpv ran perfectly fine. :)

User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Tue Jun 18, 2019 12:15 pm

jonny789 wrote:
Sun Jun 16, 2019 3:25 pm
Thanks a lot for your guidance and help. You were right. I missed the step 3 of Appendix 8 entirely. I had not installed the dependency packages first. After installing those dependencies , mpv ran perfectly fine. :)

You're welcome!

It's cool to know you're running my build on multiple Raspberries.

joural
Posts: 13
Joined: Mon Oct 08, 2018 10:42 am

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Thu Jul 04, 2019 3:00 am

Good morning, quick hypothetical question, with release of raspberry pi 4, does this make sense to install on new device? I understand that 4K hardware decoding is not going to be implemented in new linux kernel for some time( 2020/2021). Thank you

roelarmas
Posts: 1
Joined: Fri Jun 14, 2019 7:58 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Thu Jul 04, 2019 11:34 pm

Awesome contribution RPI Mike! I believe that this must be the spirit that prevails in a community of this nature!

Addressing the topic of version 4, I tried to install your solution in the new Raspbian distribution (Buster), but the task yielded errors and did not complete its work. I'm sure there are many people, and even companies that are considering or even adopting your solution for multimedia implementations.

If it seems good, I think you could make some recommendations on how to install your solution in the new RPI generation with Buster.

Infinite thanks for your effort developing and documenting this.

Regards!

grrgle
Posts: 4
Joined: Mon Jul 08, 2019 10:57 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Mon Jul 08, 2019 11:19 pm

Hi Mike, I'm excited about the power of this work you've done and eager to get it rolling on my own new 3B+. Probably because I am a noob at this, I am running into some problems and I hope you can point me in the right direction to resolve.

To the best of my ability, I have followed all your instructions. I'm running the current version of stretch, 9.9, and maybe that's the problem? but I think maybe not:

after I update and upgrade and load the script and reboot and run the script, I hit a bunch of missing packages, e.g.

Code: Select all

Reading package lists...
Building dependency tree...
Reading state information...
Package libfontconfig1-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libxcb-shm0-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package texinfo is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  install-info info

Package python-docutils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  docutils-common

Package automake is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libtool is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'automake' has no installation candidate
E: Unable to locate package checkinstall
E: Unable to locate package libva-dev
E: Unable to locate package libluajit-5.1-dev
E: Couldn't find any package by glob 'libluajit-5.1-dev'
E: Couldn't find any package by regex 'libluajit-5.1-dev'
E: Package 'libtool' has no installation candidate
E: Unable to locate package libvdpau-dev
E: Package 'libxcb-shm0-dev' has no installation candidate
E: Package 'texinfo' has no installation candidate
E: Package 'libfontconfig1-dev' has no installation candidate
E: Unable to locate package libfribidi-dev
E: Package 'python-docutils' has no installation candidate
E: Unable to locate package libjpeg-dev
E: Unable to locate package libtheora-dev
E: Unable to locate package libvorbis-dev
E: Unable to locate package libgnutls28-dev
E: Unable to locate package linux-headers-rpi2
E: Unable to locate package libomxil-bellagio-dev
E: Unable to locate package xdotool
E: Unable to locate package libcdio-cdda-dev
E: Unable to locate package libcdio-paranoia-dev
E: Unable to locate package libdvdread-dev
E: Unable to locate package libdvdnav-dev
also, further down,

Code: Select all

sudo: checkinstall: command not found
and,

Code: Select all

ERROR: gnutls not found using pkg-config
etcetera, basically it looks like absent dependencies just prevent the whole thing from working. Considering everybody else seems to just sail through if they follow the instructions, I guess I must not be doing that. Does the output above look to anyone here like any particular, identifiable form of "not following the instructions"? Dying to get this running!

grrgle
Posts: 4
Joined: Mon Jul 08, 2019 10:57 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Tue Jul 09, 2019 5:57 pm

Welps

from /etc/apt/sources.list:
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free$
Simple as that! and I'm off to the races. I love this stuff

wally333
Posts: 89
Joined: Mon Jun 06, 2016 7:09 pm

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Tue Jul 09, 2019 6:19 pm

roelarmas wrote:
Thu Jul 04, 2019 11:34 pm
Awesome contribution RPI Mike! I believe that this must be the spirit that prevails in a community of this nature!

Addressing the topic of version 4, I tried to install your solution in the new Raspbian distribution (Buster), but the task yielded errors and did not complete its work. I'm sure there are many people, and even companies that are considering or even adopting your solution for multimedia implementations.

If it seems good, I think you could make some recommendations on how to install your solution in the new RPI generation with Buster.

Infinite thanks for your effort developing and documenting this.

Regards!
Another vote for getting this on Buster for the Pi4 at the first opportunity!

This is too much for many Pi users to bite off, but it sure is useful for many, especially anyone who wants to use the Pi4 as a "Chromebook" replacement or low end desktop.

Perhaps the Pi Foundation should consider making something like Ubuntu's PPA as a way to allow curated advanced things like this to be installed via apt-get.


User avatar
RPi_Mike
Posts: 200
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: GIANT UPDATE: Build FFmpeg and mpv – Automatically in 54 Minutes!

Fri Jul 12, 2019 11:50 pm

SOMEONE LIKES MY WORK:
grrgle wrote:
Mon Jul 08, 2019 11:19 pm
Hi Mike, I'm excited about the power of this work you've done and eager to get it rolling on my own new 3B+ ..... I'm running the current version of stretch, 9.9.....





BUT THEN THEY ENCOUNTERED A WHOLE BUNCH OF PROBLEMS WHILE SUPPOSEDLY FOLLOWING MY INSTRUCTIONS — AND THEN THEY POSTED A GIANT, SCARY LIST OF "ERROR" MESSAGES THAT MAKES IT SEEM LIKE THERE'S SOMETHING WRONG WITH THE SCRIPT I PUT SO MUCH WORK INTO:
grrgle wrote:
Mon Jul 08, 2019 11:19 pm
I have followed all your instructions..... after I update and upgrade and load the script and reboot and run the script, I hit a bunch of missing packages..... Package libfontconfig1-dev is not available..... Package libxcb-shm0-dev is not available..... Package texinfo is not available..... Package automake is not available.....





AND THEN, THE NEXT DAY, THEY MIRACULOUSLY "FIX" THE "PROBLEM" AND EVERYTHING WORKS GREAT:
grrgle wrote:
Tue Jul 09, 2019 5:57 pm
Welps

from /etc/apt/sources.list:
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free$
Simple as that! and I'm off to the races. I love this stuff

All the problems you encountered have a very simple explanation.

You may have thought you had Raspbian Stretch — but you didn't!

Instead, you had a completely different operating system that I refer to as Damaged Raspbian or Altered Raspbian.

If you had been using a truly normal, perfectly standard, unmodified copy of Raspbian Stretch — as explicitly required in my instructions — you never would have encountered these "problems".

You had clearly been monkeying with the repository sources list BEFORE you even tried my tutorial. The very fact you're a self-described "noob" meant it was even more important than usual that you start with a completely clean, fresh, TOTALLY PRISTINE copy of Raspbian — and yet you started with a "monkeyed copy".

That's a privilege reserved for Linux experts only — because only an expert has the deep understanding that allows them to make fundamental system changes without messing everything up. I myself am not a true "expert".

I would point out that your sources list clearly shows the file had been tampered with — because it ends with a bizarre question mark. The ending characters of the unmodified version of that file are "non-free rpi" — not "non-free question mark"! On top of that, the entire "deb-src" line — by default — is remarked out and deactivated. Yet you have it fully activated. None of that "just happens". It means you had actively tampered with the file. I have no clue what you were trying to do — but that file is not even mentioned in my instructions.

This is why I'm very "PRO NUKE" — at least when it comes to computers. If your internet connection is good and my thoroughly-tested and proven script doesn't work — and you can't easily figure out the problem on your own — just NUKE IT! Back up your data and burn a brand-new copy of the entire operating system — and start all over again from scratch! Otherwise, you could end up spinning your wheels on a wild goose chase for endless hours and days.

For more on my general perspective, check out my philosophical statement — it appears, in red, at the bottom of the post.

Return to “Graphics, sound and multimedia”