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

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

Tue Oct 09, 2018 12:34 am

usable wrote:
Sun Oct 07, 2018 11:04 am
Just signed in to say thank you so much. You are awesome, man! ;) ;) ;)

Ah yes, I remember you – I helped you out on here about 7 months ago!

So just out of curiosity, what inspired you to thank me so much just now? Is it because you recently "upgraded" from my original tutorial to my newly automated script?

I realize that English is not your primary language (as you mentioned earlier this year) – but if you can offer a few details, I would certainly be interested to hear them!

Moredrivers
Posts: 1
Joined: Mon Oct 08, 2018 9:16 pm

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

Thu Oct 11, 2018 11:16 am

hi Mike

have a question to the scriptwriter because i can,t find the script for the ffmpeg for the rasp berry 3 . Please helpme .
requards Gerard

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

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

Fri Oct 12, 2018 6:03 am

Moredrivers wrote:
Thu Oct 11, 2018 11:16 am
i can,t find the script

I'm honestly not sure why you would make that unusual claim.

My script is right in the middle of my tutorial and is clearly marked by giant dashed lines in bold and blue. In fact, this is exactly what the beginning of it looks like:

-----------------------------------------------------------------
***START OF SCRIPT – DO NOT COPY THIS LINE OR THE DASHED LINES***
-----------------------------------------------------------------


If you're having trouble scrolling or need help with other basic computer operations, please consult a friend or instructor who can assist you. This thread is not an appropriate forum for that kind of discussion.

delboy07
Posts: 2
Joined: Sat Oct 13, 2018 10:00 am

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

Sat Oct 13, 2018 11:37 am

Found this excellent tutorial after having problems compiling ffmpeg today. Unfortunately script didn't work the problem was the same as that described by Suicinivrovich:
Suicinivrovich wrote:
Thu Sep 20, 2018 8:40 pm
Hi,
All worked fine and smooth except that for whatever reason mpv dis not compile, failing at the “waf configure” step saying the below:

Code: Select all

Checking for libav* is Libav                                         : no
Checking for Libav/FFmpeg library versions                           : no ('libavutil >= 56.12.100 libavcodec >= 58.16.100 libavformat >= 58.9.100 libswscale >= 5.0.101 libavfilter >= 7.14.100 libswresample >= 3.0.100' not found) 
Unable to find development files for some of the required FFmpeg/Libav libraries. Git master is recommended.
Problem is likely to be associated with the building of the libavcodec during the build of ffmpeg not mpv. To check this go to the ~/Vidware_Build/ffmpeg/libavcodec directory and type ls and check that you have the files

libfdk-aacenc.c libfdk-aacenc.d libfdk-aacenc.o

if you are missing the last two files then the solution to your problem is given here https://github.com/mstorsjo/fdk-aac/issues/93.


After manually applying the patch to libfdk-aacenc.c you can run the script from the make -j4 command in the ffmpeg section and all should work.

If you had down loaded a static binary from https://johnvansickle.com/ffmpeg/ as described https://www.raspberrypi.org/forums/view ... p?t=176239 this commands and script in this tutorial will not remove it and will give the impression that the compilation of ffmpeg has worked

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

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

Sun Oct 14, 2018 4:05 am

delboy07 wrote:
Sat Oct 13, 2018 11:37 am
Found this excellent tutorial after having problems compiling ffmpeg today

Exactly! In other words, after conducting a series of failed experiments building and installing OTHER versions of FFmpeg – thus making a series of unknown and fundamental alterations to the very parts of your system that my script depends on – you finally stumbled across my tutorial and expected it to work!



delboy07 wrote:
Sat Oct 13, 2018 11:37 am
Unfortunately script didn't work

Precision in language is important, especially in dealing with technical matters. Saying my "script didn't work" creates the false impression that there's something fundamentally wrong with my script. A better phrasing would have been that the script didn't work on YOUR system. This may seem like a minor semantic quibble, but it's a hugely important distinction – because it perfectly captures the true nature of the entire problem you're reporting.



delboy07 wrote:
Sat Oct 13, 2018 11:37 am
Unfortunately script didn't work the problem was the same as that described by Suicinivrovich:

Uh oh! Two separate people have now reported the same problem with RPi_Mike's script! This doesn't sound good, because it suggests a pattern – that there may indeed be something wrong with my script. After all, how could two unrelated people have the same problem if there isn't something wrong with the script?

There's just one problem with that interpretation: You failed to mention the critical part where Suicinivrovich revealed that before he used my script, he executed a totally separate and unrelated script that had "gone wild" on his system and "deleted and messed with the setup" he had previously created with prior versions of FFmpeg and mpv. In other words, just like you, the very parts of his system that my script relies on had been altered in unknown and fundamental ways.



delboy07 wrote:
Sat Oct 13, 2018 11:37 am
Problem is likely to be associated with the building of the libavcodec during the build of ffmpeg not mpv..... if you are missing the last two files then the solution to your problem is given here https://github.com/mstorsjo/fdk-aac/issues/93

Believe it or not, I might actually agree with your "proximate" diagnosis as it relates to your particular, experimented-on system. But it's important to distinguish between a "proximate" diagnosis that may be superficially correct and a fundamental diagnosis that truly explains the problem.

A good example of this would be a doctor that correctly diagnoses a patient's infection – but simultaneously gets the true diagnosis wrong! But wait – how can that be? That makes no sense! How can someone be right – but ultimately wrong – about the same thing? It's easy: Unbeknownst to the doctor, the patient has leukemia – a cancer of the bone marrow that has now spread to the white blood cells. And what do the white blood cells do? They fight infection! So although it's good that the doctor spotted the infection, he has also condemned the patient to death by entirely missing WHY the infection occurred in the first place.

The link you reference points to a discussion about FFmpeg and fdk-aac problems with git-acquired source code from master – developmental code that constantly changes from day to day. My script, however, deliberately avoids all those unpredictable problems by using LOCKED-DOWN "stable release tarballs". That means my script reliably uses the same proven source code every time – whether you ran it in the past or run it in the future. That also means that it's impossible for any source-code-related problems to suddenly crop up in my script – with libavcodec or anything else. [OK, fine – nothing is truly "impossible". For example, a hacker could theoretically break into the GitHub servers and secretly tamper with the source code inside a locked-down tarball.]

So no – when it comes to my script, there is no "problem" that's "associated with the building of the libavcodec during the build of ffmpeg". On a perfectly normal, standard copy of Raspbian that hasn't been tainted by a series of previous experiments with other FFmpeg tutorials and builds, my script works perfectly. In fact, what I told Suicinivrovich last month applies equally in this case: "The bottom line is that my entire script is "known good". It has been thoroughly tested – personally by me – on a clean, properly-working copy of Raspbian Stretch."



delboy07 wrote:
Sat Oct 13, 2018 11:37 am
If you had down loaded a static binary from https://johnvansickle.com/ffmpeg/ as described [at] https://www.raspberrypi.org/forums/view ... p?t=176239 [the] commands and script in this tutorial will not remove it

Exactly! My script makes no attempt whatsoever to tamper with or "sanitize" a person's operating system from previous unknown experiments with FFmpeg or any other software. In fact, I proudly failed to test my script on systems with Raspbian + John Van Sickle – just as I proudly failed to test my script on systems with Raspbian + John von Neumann.

That's why I repeatedly bent over backwards – multiple times, all throughout my tutorial – to say that the only "guarantee" I offer is that my script will work on truly "clean", "normal", "standard" copies of Raspbian. I made such a giant show of this because I know from personal experience that the Raspberry community is loaded with people that love to experiment and "tinker" and do all kinds of things with their systems – and to be clear, there's absolutely nothing wrong with that! In fact, it's the core ethos of the Raspberry Pi Foundation and I fully support it.

Nonetheless, I also know that this highly experimental environment poses an "unfair" reputational danger to my tutorial – a tutorial that I have worked on very hard to fully validate and perfect – because some will inevitably come into it with an unorthodox or damaged system with a "history" — the kind of history that's guaranteed to throw a giant monkey wrench into any script!

innocent_bystander
Posts: 5
Joined: Mon Oct 15, 2018 12:15 am
Location: Florida, USA
Contact: Yahoo Messenger

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

Mon Oct 15, 2018 1:00 am

Hi RPi_Mike,
Thanks for putting together the script. Is there any reason not to host prebuilt .deb binaries in a repo and have everyone do the good ole:

Code: Select all

add-apt-repository <Mike's cool repo name>
apt install ffmpeg mpv etc...
Will save you some headaches from dealing with people's compilation problems, etc. The trees will like it too. ;)

-TJ

delboy07
Posts: 2
Joined: Sat Oct 13, 2018 10:00 am

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

Mon Oct 15, 2018 12:05 pm

Think I should have been more verbose in my previous post. Apologies if your thought I was in anyway criticising your brilliant work. I should have said " the script didn't work on my system because of previous attempts I had made to install ffmpeg which I had failed to fully remove from the system".

This tutorial is excellent and if the instructions are followed fully there is no problem. Indeed, in nearly fify years of programming I don't think I have seen a clearer and better example.

What my post was trying to do was to explain that I was able to generate Suicinivrovich error message when like him I tried the script on a machine where I had tried to compile version 4.0.2 without success not using this script. In my case I had then download directly a static version of ffmpeg to use while I sorted out the problem (not something to be recommended.)

Before running the script I thought I had cleaned the machine of all my earlier attempts - but when it failed I finally discovered that the problem was with still having fdk v2 on the machine. This took me a while to discover. For while I had used package manager to clean the machine it hadn't removed the static copy of ffmpeg. So at first I thought the script had compiled the ffmpeg and the problem was with mpv build. It was only on reading through the full output did I realise the problem and remember that I had directly installed the ffmpeg static.

Please accept my apology if I have offended you. There is definitely no problem with you script. Keep up the good work.
Still learning to recognise brick walls when I see them

frost-byte
Posts: 2
Joined: Mon Oct 22, 2018 6:07 pm

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

Mon Oct 22, 2018 6:28 pm

Hi Mike,

First of all thanks for taking the time to maintain your project and so thoroughly document it.
I've been able to set this up on two different Raspberry Pi's. I just needed to have access to FFMpeg because my intention is to use it to stream to Twitch. (I already set up the first PI to take a recorded stream from a laptop connected to it and then encode and stream it up to Twitch and that works)

For the second PI I've added the v2 Camera Module and I'd like to composite the output of that with the recorded stream. I found another repo that lets you monitor the camera output via a web interface, however, because OpenGl ES only allows one video stream to use the GPU I obviously can't use mpv and that software at the same time. (Though I'm going to look into how I can composite the stream from the other device with the output of the camera, then maybe I can just view the combined output?)

I guess my question is, do you know of software that can do that, that will run on the RPi? (Combine the camera output with another stream) I'm aware that this is an indirect use of what you provide, but was hoping you might know of something, since you obviously already know about related software.

Thanks,
B

innocent_bystander
Posts: 5
Joined: Mon Oct 15, 2018 12:15 am
Location: Florida, USA
Contact: Yahoo Messenger

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

Tue Oct 23, 2018 6:46 pm

frost-byte wrote:
Mon Oct 22, 2018 6:28 pm
I guess my question is, do you know of software that can do that, that will run on the RPi? (Combine the camera output with another stream)
You should be able to do this with ffmpeg using 'scale' and 'overlay' filters. Take a look over here: https://www.oodlestechnologies.com/blog ... ing-FFMPEG

-TJ

frost-byte
Posts: 2
Joined: Mon Oct 22, 2018 6:07 pm

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

Thu Oct 25, 2018 1:13 am

Thanks TJ,

In the meantime I've been able to put together an ffmpeg command to combine my video stream from udp into an overlay using the complex filter. (likely what you are referring to) I'm able to get my stream working and it's sending it up to twitch, unfortunately I'm still trying to work out what is causing some visual artifacts. I've got a Virtue case for my Pi 3B+ that has a fan and 3 heat sinks to control the temps, so it's probably just a matter of the right config for ffmpeg. I was able to figure out that there are some hardware encoders/decoders available using this build of ffmpeg, and that greatly helped get rid of a lot of the errors I was seeing.

Of course none of this directly relates to this guide, other than the fact that the ffmpeg compilation seems to work very well. :D

-B

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

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

Mon Oct 29, 2018 12:56 am

delboy07 wrote:
Mon Oct 15, 2018 12:05 pm
Apologies if you thought I was in any way criticising your brilliant work. I should have said "the script didn't work on my system because of previous attempts I had made to install FFmpeg which I had failed to fully remove from the system".

This tutorial is excellent and if the instructions are followed fully there is no problem. Indeed, in nearly fifty years of programming I don't think I have seen a clearer and better example.

Your reply is greatly appreciated. To be honest, you handled your response in a very thoughtful and reasonable way. So thank you!

Now the following is not directed to anyone in particular – it's just a general commentary:

My 16,000-word tutorial sometimes feels like a miniature doctoral thesis with a giant catch:

When a PhD candidate defends their dissertation, it's a one-time deal. Although their claims may face a vigorous challenge by a panel of experts, they ultimately get to put it behind them if they make it through the gauntlet. Once they've earned their PhD – barring a future discovery of outright fraud – no one can come along later and "challenge" their accolade.

This site, however – like any public forum – is the opposite of that: Although I have thoroughly proven my claims, any random person on the Internet is free to come along and "challenge" me with bogus claims at any time.

Whether these claims are deliberate or unintentional, having to repeatedly beat back false claims about alleged "errors" in my thoroughly tested work can get quite tiresome. This is especially true if someone didn't even read my carefully-documented instructions – or merely ASSERTS that it "didn't work" without any explanation or honesty about the true nature of their system and what they may or may not have done to it before they even laid eyes on my tutorial.

Of course, I could just ignore all of this. And some day I may do exactly that – allowing the inevitable free-for-all to commence. After all, even the universe itself appears to have an expiration date – so I know I can't keep defending my work forever!

For now, at least – due to the heavy "psychological investment" I have made in my tutorial – I will continue to hold the line with great vigor and aplomb.



innocent_bystander wrote:
Mon Oct 15, 2018 1:00 am
Thanks for putting together the script. Is there any reason not to host prebuilt .deb binaries in a repo and have everyone do the good ole:

add-apt-repository <Mike's cool repo name>

apt install ffmpeg mpv etc...

If they wanted, the Raspberry Pi Foundation (RPF) could take things even further and make my entire suite of FFmpeg / mpv software the official Raspbian repository build.

But there's a very good reason not to do any of that. That reason, in fact, is emphasized repeatedly in what amounts to the RPF's official mission statement. The entire thing is only two paragraphs long, so here it is – emphasis added by me:


The Raspberry Pi Foundation is a UK-based charity that works to put the power of digital making into the hands of people all over the world, so they are capable of understanding and shaping our increasingly digital world, able to solve the problems that matter to them, and equipped for the jobs of the future.

We provide low-cost, high-performance computers that people use to learn, solve problems and have fun. We provide outreach and education to help more people access computing and digital making. We develop free resources to help people learn about computing and how to make things with computers, and train educators who can guide other people to learn.



Everyone, of course, is free to have their own opinion about my tutorial and script in terms of what its ultimate purpose should be. There is, after all, no "objective truth" when it comes to the final form a piece of code should take. In that sense, it's a subjective matter of taste. But in my opinion, the primary purpose of my tutorial – and its thoroughly annotated Bash script that explains exactly what I'm doing at every step – is that of a learning tool that fits perfectly with the RPF's mission.

The fact that a suite of "killer apps" comes along for the ride is really just a giant bonus – and a strong incentive to do a modest bit of learning in the process.

If my entire body of work "disappeared" and became available through a simple one-liner, a very practical example of computer science would vanish along with it – how to turn raw source code into a working program.

I'm well aware that my tutorial and a quick installer could co-exist. But if people knew they could obtain the fruits of my tutorial through a one-liner that only takes 3 seconds, it's just human nature that few would bother to learn anything about it. Most would just "install it" and learn nothing in the process, thus defeating the very mission of the RPF.

As it stands, it only takes about 5 brief minutes to prepare my fully automated script for execution – so I'm already striking a very reasonable balance between learning and convenience.



frost-byte wrote:
Thu Oct 25, 2018 1:13 am
Of course none of this directly relates to this guide, other than the fact that the FFmpeg compilation seems to work very well. :D

Glad you're "very happy" with my build of FFmpeg (as indicated by your emoji). You're right, though – your advanced compositing experiments have little relation to my guide – other than the fact my script provides a state-of-the-art platform to conduct your own investigations. To the entities known as "frost-byte" and "innocent_bystander": Let's try to keep things focused and "on topic"!

Return to “Graphics, sound and multimedia”