Skip to content

HLS V4L2 M2M encoder - #784

Merged
guysoft merged 1 commit into
guysoft:develfrom
chudsaviet:feature/hls-v4l2m2m
Jul 11, 2022
Merged

HLS V4L2 M2M encoder#784
guysoft merged 1 commit into
guysoft:develfrom
chudsaviet:feature/hls-v4l2m2m

Conversation

@chudsaviet

Copy link
Copy Markdown
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

guysoft commented Jul 11, 2022

Copy link
Copy Markdown
Owner

Thanks for your contribution!

@chudsaviet

Copy link
Copy Markdown
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

cp2004 commented Jul 12, 2022

Copy link
Copy Markdown
Contributor

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

guysoft commented Jul 12, 2022

Copy link
Copy Markdown
Owner

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

@guysoft

guysoft commented Jul 12, 2022

Copy link
Copy Markdown
Owner

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

@guysoft

guysoft commented Jul 15, 2022

Copy link
Copy Markdown
Owner

@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
Copy Markdown
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

guysoft commented Jul 16, 2022

Copy link
Copy Markdown
Owner

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

@chudsaviet

Copy link
Copy Markdown
Contributor Author

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

@guysoft

guysoft commented Jul 17, 2022

Copy link
Copy Markdown
Owner

Fixed, builds on both now

@guysoft

guysoft commented Jul 26, 2022

Copy link
Copy Markdown
Owner

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
Copy Markdown
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

guysoft commented Jul 27, 2022

Copy link
Copy Markdown
Owner

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

guysoft commented Aug 4, 2022

Copy link
Copy Markdown
Owner

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

@chudsaviet

Copy link
Copy Markdown
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

guysoft commented Aug 4, 2022

Copy link
Copy Markdown
Owner

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

@chudsaviet

Copy link
Copy Markdown
Contributor Author

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

@guysoft

guysoft commented Aug 4, 2022

Copy link
Copy Markdown
Owner

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