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

HLS V4L2 M2M encoder #784

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Conversation

chudsaviet
Copy link
Contributor

  1. Building FFmpeg from source for HLS.
  2. Using V4L2 M2M encoder.

Tested on Raspberry Pi OS 32bit and 64bit. CPU load on Rpi4 is around 10%.

@chudsaviet chudsaviet mentioned this pull request Jul 11, 2022
@guysoft guysoft merged commit 9c07cd0 into guysoft:devel Jul 11, 2022
@guysoft
Copy link
Owner

guysoft commented Jul 11, 2022

Thanks for your contribution!

@chudsaviet
Copy link
Contributor Author

@guysoft , I see this pull request caused build time to increase from 10 minutes to 2 hours. I can go disable unnecessary codecs from ffmpeg build, but it won’t help dramatically.

@cp2004
Copy link
Contributor

cp2004 commented Jul 12, 2022

I wonder if there is a way ffmpeg could be built once, and then the binary just downloaded from somewhere as part of the OctoPi image? Since it is building from a specific commit it seems like it shouldn't have to re-build every time.

@guysoft
Copy link
Owner

guysoft commented Jul 12, 2022

Should be able to be built once.
I will have to look in to it though

@guysoft
Copy link
Owner

guysoft commented Jul 12, 2022

Could be built and exported once using copy_and_export_folder from CustomPiOS. Then loaded if it already exists from a web server.

@guysoft
Copy link
Owner

guysoft commented Jul 15, 2022

@chudsaviet
Hey,
This is currently breaking the nightly, because the nightly build is done on a raspberrypi running a 32bit userspace and a 64bit kernel.

The ffmpeg build determines the build arch according to the kernel used and this causes the build to fail.

There should be a flag to tell it explicitly based on on what CustomPiOS is building what arch to build for.

Attaching a filed log:

cd FFmpeg-FFmpeg-9450f75
+ ./configure --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-ffplay --disable-ffprobe
install prefix            /usr/local
source path               .
C compiler                gcc
C library                 glibc
ARCH                      aarch64 (genericcd FFmpeg-FFmpeg-9450f75
+ ./configure --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-ffplay --disable-ffprobe
install prefix            /usr/local
source path               .
C compiler                gcc
C library                 glibc
ARCH                      aarch64 (generic

consoleText.txt

@chudsaviet
Copy link
Contributor Author

I was building in Docker on a M1 Mac, both 32 bit and 64bit worked.
Anyway, we will have to switch to prebuilt binary. And when FFmpeg will have the next version released, we will be able to switch back to FFmpeg from repository.

@guysoft
Copy link
Owner

guysoft commented Jul 16, 2022

I think there should be a way to pass the configure what arch to build for.

@chudsaviet
Copy link
Contributor Author

Yes, I believe configure uses arch command to determine architecture.

@guysoft
Copy link
Owner

guysoft commented Jul 17, 2022

Fixed, builds on both now

@guysoft
Copy link
Owner

guysoft commented Jul 26, 2022

Current devel branch exports ffmpeg HLS that is built to the workspace folder. So we could have some logic that you place that inside OctoPi/src/modules/octopi/filesystem/hls . Then the build script can use unpack and check it it has a pre-built binary or not. So you could have a shorter build time.

@chudsaviet
Copy link
Contributor Author

I see. Exact mechanism is not the problem.
The problem is managing binaries and their security. I'm not very eager to go this deep. Also, after next FFmpeg version will be released, we will be able just to use ffmpeg from OS repo.
I was working on next things:

  1. Minimizing FFmpeg build options, so its builds much faster.
  2. Ensuring that in CustomPiOS /tmp is mounted as tmpfs, so the build is faster. Can you help me on this?

@guysoft
Copy link
Owner

guysoft commented Jul 27, 2022

It seems like it would just be best to wait after FFmpeg version will be released.

  1. I am not sure what to remove
  2. You don't necessarily have access to tmpfs. It depends on your build environment.

@guysoft guysoft mentioned this pull request Aug 4, 2022
@guysoft
Copy link
Owner

guysoft commented Aug 4, 2022

We might want to add instructions how to activate it if you would like to add that

@chudsaviet
Copy link
Contributor Author

Yeah, sorry, I had much work last couple of weeks.
“activate it” - what do you mean?
“I am not sure what to remove” - there are dozens of codecs in ffmpeg, and for HLS, we don’t need most of them. We can build a limited ffmpeg just for HLS, and use standard ffmpeg from repository for everything else.

@guysoft
Copy link
Owner

guysoft commented Aug 4, 2022

I mean that I am not sure the setting in octopi.txt is documented.

@chudsaviet
Copy link
Contributor Author

It was experimental, so I haven't documented it in the past.
Which document shall I put the info to?

@guysoft
Copy link
Owner

guysoft commented Aug 4, 2022

It should go https://github.com/guysoft/OctoPi/wiki
But that also needs some care ATM, I don't know if its worth sending you there to document. Unless if you think it would help.

@guysoft guysoft mentioned this pull request Oct 27, 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

Successfully merging this pull request may close these issues.

3 participants