How can I record video on a Pinephone?
#11
My scripts still work for me, I just had to update (yet again) the name of the PulseAudio device:
http://svn.calcforge.org/viewvc/pinephon...revision=3
  Reply
#12
(07-04-2024, 07:21 PM)Kevin Kofler Wrote: My scripts still work for me, I just had to update (yet again) the name of the PulseAudio device:
http://svn.calcforge.org/viewvc/pinephon...revision=3

Which PinePhone version and operating system are you using?
I am using v1.2b hardware revision convergence package (Mobian edition) with an updated Mobian operating system.
The PulseAudio device is not the issue for me because with the command "pactl list | grep alsa_input" (https://superuser.com/questions/462309/l...321#462321) I can see the device name is still this one:
alsa_input.platform-sound.HiFi__hw_PinePhone_0__source
I just had to replace /dev/video2 with /dev/video3
I found the correct ID with this command:
media-ctl -d1 -p
When running your script, ffmpeg freezes and it is impossible to kill the process even with "sudo killalll -9 ffmpeg" (this results in a black screen when using the Megapixels camera app so we have to restart the PinePhone). I can see the same error in dmesg as the one I mentioned for another script:
https://gitlab.com/Alaraajavamma/fastvid...1988350434
  Reply
#13
PinePhone (original A64) Beta Edition (hardware revision v1.2b) with convergence package (3GB/32GB edition), running a fully updated Manjaro ARM Plasma Mobile Edition stable.

You are running Mobian stable, which is a really really old distribution by mobile GNU/Linux standards. Your kernel is Linux 6.1.x (Bookworm shipped with 6.1.69, you should have 6.1.97 available as an update), my PinePhone is running Linux 6.7.5. The error you are seeing seems to pretty clearly be a bug in the kernel driver for the camera.
  Reply
#14
(07-08-2024, 05:59 PM)Kevin Kofler Wrote: PinePhone (original A64) Beta Edition (hardware revision v1.2b) with convergence package (3GB/32GB edition), running a fully updated Manjaro ARM Plasma Mobile Edition stable.

You are running Mobian stable, which is a really really old distribution by mobile GNU/Linux standards. Your kernel is Linux 6.1.x (Bookworm shipped with 6.1.69, you should have 6.1.97 available as an update), my PinePhone is running Linux 6.7.5. The error you are seeing seems to pretty clearly be a bug in the kernel driver for the camera.

Thanks for the hint. Currently, there is only Linux kernel 6.1.69 in Mobian stable (http://repo.mobian.org/dists/bookworm/ma...ary-arm64/) and in Mobian staging there is 6.6.37 (http://repo.mobian.org/dists/staging/main/binary-arm64/).
I installed linux-image-6.6-sunxi64 from the staging repository and ffmpeg is now working to record videos from the camera. However the Megapixels app has now an error when trying to take a picture with the new kernel, maybe you have an idea:
https://gitlab.com/Alaraajavamma/fastvid...1990734890
  Reply
#15
There is 6.1.98+sunxi64-1 in bookworm-updates: http://repo.mobian.org/dists/bookworm-up...ary-arm64/
See also https://packages.mobian.org/

Maybe try the bookworm-updates kernel, if that fixes the ffmpeg issue without breaking Megapixels?

For what it's worth, I have Megapixels working with a 6.7.5 kernel on Manjaro ARM. The thing is, Megapixels in Mobian stable (bookworm) is also outdated, but that package comes from Debian (see https://packages.debian.org/bookworm/megapixels), so Mobian staging does not have an update for it. Only Debian trixie does (https://packages.debian.org/trixie/megapixels).

Mixing Mobian staging packages with a Debian stable base is not a good idea. Mobian staging is staging for Mobian testing, so it should be used only if you upgrade everything to Debian/Mobian testing, i.e., currently trixie.

Either use Mobian bookworm with bookworm-updates enabled (How do people end up with a bookworm install without bookworm-updates? Does Mobian not enable updates by default? That is very broken!) or use Mobian trixie with or without staging enabled, not a mix.
  Reply
#16
The repository bookworm-updates was not enabled by default in the Mobian 12.0 installer for the PinePhone (neither the Mobian bookworm-updates repository, nor the Debian bookworm-updates repository). On https://blog.mobian.org/posts/2023/06/10/bookworm/ they mention to add the repository for "users willing to test those updates (and report any regression they might cause) before they migrate". It looks like the repository bookworm-updates from Mobian is meant for users who want to test updates, unlike the repository bookworm-updates from Debian, which is meant for all users who don't want to wait the next point release (https://wiki.debian.org/StableUpdates).
I just tested the Linux kernel 6.1.98+sunxi64-1 from Mobian bookworm-updates but it did not fix the video recording issue.

It is not mentioned on https://blog.mobian.org/posts/2021/03/15...le-distro/ that Mobian staging should not be used with Mobian stable, they just say that Debian unstable repository should not be added (at the time of the article, Mobian was using Debian bullseye which was going to be stable in a few months).
I configured APT pinning preferences to not install anything by default from Mobian staging, so I only install the Linux kernel from Mobian staging, this is pretty safe I think and has the advantage to not compile the Linux kernel myself (in addition to getting kernel updates). Anyway, this is the only choice I had currently if I want to keep the stability of a Mobian stable base and fix the video recording issue. For the moment, I don't really need to switch to Mobian testing. Since the latest Megapixels git version with video recording did not work on Mobian, I compiled the latest release 1.8.2 which does not have the issue with new kernels unlike version 1.6.0.

Update: A better solution than using the Linux kernel from the Mobian staging repository with Mobian stable (bookworm) is to use it from Mobian testing (trixie) since the Linux kernel is more stable (currently 6.6.23+sunxi64-1 for testing instead of 6.6.39+sunxi64-1 for staging). Many people are already mixing Debian stable with testing, which should be safe with the appropriate APT pinning for a package like the Linux kernel that does not have dependencies that could break the system:
https://serverfault.com/questions/22414/...om-testing
A priority of -1 for Mobian testing repository can be an additional security to not install accidentally packages from testing (https://unix.stackexchange.com/questions...references).
This way, we have to explicitly request a package to be installed from testing:
sudo apt install linux-image-6.6-sunxi64 -t trixie
I also had to use Megapixels 1.6.1 on Mobian stable (with Linux kernel 6.6 from Mobian testing), otherwise the front camera pictures look more red / sunny than they actually are. Maybe this is due to this change in Megapixels 1.7.0:
"NOTE: this version of megapixels is not compatible with old libtiff versions (ca 2019 and earlier)"
https://gitlab.com/megapixels-org/Megapixels/-/tags
  Reply
#17
For information, I was able do video recording with ffmpeg and preview the video at the same time with the parameter "-f xv display":
https://gist.github.com/baptx/7faaaf876e...25bde41625

There is a delay of a few seconds in the video preview but I don't know if it can be improved without lowering the resolution and FPS.
  Reply
#18
(07-19-2024, 10:19 AM)baptx Wrote: For the moment, I don't really need to switch to Mobian testing. Since the latest Megapixels git version with video recording did not work on Mobian, I compiled the latest release 1.8.2 which does not have the issue with new kernels unlike version 1.6.0.
But that is exactly the point I was trying to make about not mixing packages from stable and from testing or staging. The Megapixels in testing should work with the 6.6 kernels in testing and staging. The one in stable is just too old. You worked around it by compiling your own Megapixels, but you would not have had to do that if you were not trying to cherry-pick only the kernel from testing onto an install of stable.
  Reply
#19
In case someone is interested, I updated the video recording script with preview from my previous post, it is now possible to preview the video without delay while recording thanks to v4l2loopback which allows accessing a camera from several applications at the same time.
I noticed that after recording around 2 minutes with preview, the phone crashed but I was able to fix the issue and record more than 5 minutes with preview by lowering the FPS to 20 (which may appear as around 15 FPS with the variable framerate ffmpeg parameter "-fps_mode vfr" to avoid duplicated frames) but the video should be smooth enough.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Ordered PinePhone till today have no info or confirmation about order hennadiyt 1 175 10-05-2024, 02:20 PM
Last Post: KC9UDX
  US Mobile, via T-Mobile, won't support Pinephone Pro - SOLVED, SIMPLY jovval 11 5,410 07-28-2024, 03:42 PM
Last Post: dchang0
  Pinephone not booting, always vibrating alexander12 8 6,559 07-19-2024, 07:50 PM
Last Post: Blackheart
  PinePhone Pro P. Siera 2 675 07-17-2024, 12:41 AM
Last Post: P. Siera
  eSIM on PinePhone just_a_q 6 4,190 07-02-2024, 01:30 AM
Last Post: zetabeta
  PinePhone Boots but only Shows Black Screen with Backlight danyeaw 1 553 06-30-2024, 10:18 AM
Last Post: danyeaw
  Pinephone won't boot. spha 13 5,489 05-15-2024, 10:31 PM
Last Post: Richy_T
  Pinephone boot. Richy_T 5 1,376 05-15-2024, 03:35 PM
Last Post: Richy_T
  PinePhone - boot from microSD laserpyramid 9 2,627 05-03-2024, 10:09 AM
Last Post: laserpyramid
  pinephone virtual keyboard aular 4 1,379 04-10-2024, 03:45 PM
Last Post: aular

Forum Jump:


Users browsing this thread: 5 Guest(s)