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

raspivid annotation error #465

Closed
tomsaul opened this issue May 8, 2018 · 16 comments
Closed

raspivid annotation error #465

tomsaul opened this issue May 8, 2018 · 16 comments

Comments

@tomsaul
Copy link

tomsaul commented May 8, 2018

When using raspivid and adding an annotation with a background it is not formatting properly. THe command line I am using is 'raspivid --annotate 1036 --annotateex 16,0xff,0x808000 ...'. The background is not aligning with the text (see example).

image

@6by9
Copy link
Contributor

6by9 commented May 11, 2018

Please confirm the version of the firmware you are running (vcgencmd version), and the resolution you are encoding at (you've trimmed your command).

There was a bug I recall from ages ago - version control suggests Feb 2015, so it really should be resolved.

Just doing raspivid -a 1024 --annotateex 16,0xff,0x808000 -a "09:35:31 05/08/18" -o /dev/null which should reproduce your example image is working fine for me (defaults to 1920x1080 for the resolution).

@tomsaul
Copy link
Author

tomsaul commented May 11, 2018

vsgencmd result is
pi@Cam1:~ $ vcgencmd version
Jul 3 2017 14:20:31
Copyright (c) 2012 Broadcom
version 4139c62f14cafdb7d918a3eaa0dbd68cf434e0d8 (tainted) (release)

If I use a hard coded -a value (i.e. -a "00:00:00 00/00/0000") it is fine, but if I use -a 1036 or -a 1024 -a "%X %D" it exhibits the same offset problem. It is also fine if I don't use the -ae, but then I can't control the font size used.

@6by9
Copy link
Contributor

6by9 commented May 11, 2018

July 2017 is pretty old so worth checking with the latest firmware. Having said that I can't see any recent changes relating to the text overlay.

To track this down I need to know under EXACTLY what conditions it shows up. Please quote your FULL raspivid command, not just snippets. It's going to be some particular combination of width of the overlay text with regard 128 pixel boundaries that is causing the problem. It's strange that hard coded text isn't triggering it as they both go through the same sprintf.

@tomsaul
Copy link
Author

tomsaul commented May 11, 2018

Here are a few of the variations I have tried. Is there a newer release, and if so how do I update? I have done the standard apt-get updates (from standard repositories).

This works as expected - text is in the box.
raspivid -mm matrix --annotate 1024 -ae 16,0xff,0x808000 -a "00:00:00 00/00/0000" -n -t 15100 -w 800 -h 600 -fps 5 -o /tmp/$USER-$mac.h264 && MP4Box -new -add /tmp/$USER-$mac.h264:fps=5
/tmp/$USER-$mac.mp4 && rm /tmp/$USER-$mac.h264 && ./camsend.sh /tmp/$USER-$mac.mp4 $mac.mp4

This fails
raspivid -mm matrix --annotate 1036 --annotateex 16,0xff,0x808000 -n -t 15100 -w 800 -h 600 -fps 5 -o /tmp/$USER-$mac.h264 && MP4Box -new -add /tmp/$USER-$mac.h264:fps=5 /tmp/$USER-$mac.mp4 && rm /tmp/$USER-$mac.h264 && ./camsend.sh /tmp/$USER-$mac.mp4 $mac.mp4

This also fails
raspivid -mm matrix --annotate 1024 -ae 16,0xff,0x808000 -a "%X %D" -n -t 15100 -w 800 -h 600 -fps 5 -o /tmp/$USER-$mac.h264 && MP4Box -new -add /tmp/$USER-$mac.h264:fps=5
/tmp/$USER-$mac.mp4 && rm /tmp/$USER-$mac.h264 && ./camsend.sh /tmp/$USER-$mac.mp4 $mac.mp4

@6by9
Copy link
Contributor

6by9 commented May 11, 2018

Thank you. 800x600 does appear to trip it up, hence why I asked what resolution you were using in my first response. I can investigate next week.

If apt update, apt upgrade isn't getting you a more recent firmware then I surmise you're still on the Jessie release. cat /etc/os-release to confirm. That is no longer supported as Stretch was released the middle of last year, hence the lack of updates.
The best solution is to update to Stretch so that you get udpates on all packages.
You can use sudo rpi-update to get the absolute latest firmware and kernel, but please use caution on that as there is the potential for the odd regression creeping in.

@tomsaul
Copy link
Author

tomsaul commented May 11, 2018

Yes - on Jessie

root@Cam1:/home/pi# cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian

I'll try some variations on image size to see if I can circumvent in the interim. Not sure if I want to deal with dev versions of OS for this.

@tomsaul
Copy link
Author

tomsaul commented May 11, 2018

FWIW - so far the only sizes I have found where it works properly are 640x480 and full size. 1024x768 does not, 1000x750 does not.

I'm also having issues with a secondary -a not working as expected - for example "raspivid -a 1024 -a "%X" ..." is showing '%X' in the image, not the time. I'm fairly certain this was working earlier, so I will test further.

@6by9
Copy link
Contributor

6by9 commented May 13, 2018

If you're that desperate for a fix, then I suspect the issue is where the overall width of the overlay is less than 128 pixels. Longer strings are correctly split between the tiles of the image format.

@6by9
Copy link
Contributor

6by9 commented May 13, 2018

And "%X" by itself has never been supported by itself to include the time/date. You can set the time and/or date flags (4 and 8) and then provide an override on the formatting string, but %X by itself will print those two characters.

@6by9
Copy link
Contributor

6by9 commented May 14, 2018

A corner case.
At text size 16 the default time/date string ends up at exactly 128 pixels wide and the splitting between columns code is slightly wrong.

Quickest fix for you is to add -a "%X %x " to add a single space to the overall string, and that fills in the background correctly. I'll sort out a firmware patch to fix the underlying issue in one of the upcoming releases.

@tomsaul
Copy link
Author

tomsaul commented May 15, 2018

Thanks - and FWIW - it was not clear (to me) from the documentation that the -a 'strftime type formatting' also required that you include the respective numerical mask (-a 4, -a 8, -a 12) to activate/allow it. In any case, adding some extra padding has done the trick.

popcornmix added a commit to raspberrypi/firmware that referenced this issue May 18, 2018
kernel: firmware/raspberrypi: Notify firmware of a reboot
See: #968

kernel: config: Add CONFIG_DM_CACHE
See: raspberrypi/linux#2553

kernel: Cleanup of bcm2708_fb file to kernel coding standards

kernel: Add ability to export the pin used by the gpio-poweroff driver
See: raspberrypi/linux#2552

kernel: Revert: Sets the BCDC priority to constant 0

firmware: vc_image: vc_image_fill_yuv_uv sometimes overfilled the first column
See: raspberrypi/userland#465

firmware: arm_loader: Add SET_NOTIFY_REBOOT message
See: #968

firmware: gencmd: Report temperature with read_ring_osc values
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue May 18, 2018
kernel: firmware/raspberrypi: Notify firmware of a reboot
See: raspberrypi/firmware#968

kernel: config: Add CONFIG_DM_CACHE
See: raspberrypi/linux#2553

kernel: Cleanup of bcm2708_fb file to kernel coding standards

kernel: Add ability to export the pin used by the gpio-poweroff driver
See: raspberrypi/linux#2552

kernel: Revert: Sets the BCDC priority to constant 0

firmware: vc_image: vc_image_fill_yuv_uv sometimes overfilled the first column
See: raspberrypi/userland#465

firmware: arm_loader: Add SET_NOTIFY_REBOOT message
See: raspberrypi/firmware#968

firmware: gencmd: Report temperature with read_ring_osc values
@6by9
Copy link
Contributor

6by9 commented May 22, 2018

The proper fix should now be merged into the firmware if you use sudo rpi-update to update.

As usual be aware that this picks up the "testing" branch for both firmware and kernel, so either backup first, do it on an unimportant sdcard, or accept that there is a small chance of regressions.

@6by9
Copy link
Contributor

6by9 commented May 24, 2018

I'm happy that this issue is fixed.
Please confirm for your test case, otherwise I'll close the issue in a week.

@6by9
Copy link
Contributor

6by9 commented Jun 12, 2018

Closing as it is understood that the issue is fixed.

@6by9 6by9 closed this as completed Jun 12, 2018
mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this issue Jul 23, 2018
… fixes:

- firmware: config: Add gpio command
  See: #955

- firmware: hat_lib: Only probe HAT EEPROM if ID pins are inputs

- firmware: Added a arm_display_kick function

- firmware: Possible fix for HDMI audio pause
  See: #547

- firmware: arm_loader: Always set the turbo frequencies immediately
  See: #956

- firmware: platform: Partial revert for eemc clock change for slice
  See: https://forum.libreelec.tv/thread/11930-libreelec-8-2-4-causes-slice-3-to-hang/

- firmware: clockman: Don't use OSC for pixel clock
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=24679&start=150#p1297298

- firmware: config: gpio - Allow pn (pull none) as alternative to np (no pull)

- firmware: arm_loader: Use a wrapper to set clocks either through turbo or non-turbo interfaces
  See: #967

- firmware: platform: Allow vec pll to be adjusted
  See: #960

- firmware: platform: Pi3 B+ reduce sdram freq to 450 while investigations are ongoing
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=208821

- firmware: arm_loader: Allow hdmi_ignore_composite to disable any display initialisation
  See: raspberrypi/userland#447

- firmware: Add aphy and dphy slew and drive register controls

- firmware: Extra reg writes to ensure the LCD display starts up at 800 wide

- firmware: platform: Lower temperature thresholds for extra pips to 50/60

- firmware: video_encode: Add support for YVU420Planar and YVU420SemiPlanar
- firmware: video_decode: Support YV12, NV12, and NV21 output
- firmware: video_decode: Support reporting colour space
- firmware: IL rawcam: Fix copy/paste error on timing setup
- firmware: MMAL: Populate buffer header TYPE_SPECIFIC fields

- firmware: video_encode: Filter the list of encoders based on variant

- firmware: mmal: Relax requirement on a buffer in mmal_port_send_buffer

- firmware: platform: avs: Also apply chicken bits to boost voltage

- firmware: Match phy setup same as bootcode for device mode initialisation

- firmware: Add logging_messages to UART

- bootcode: Fix 3B+ bootcode.bin only booting

- firmware: vc_image: vc_image_fill_yuv_uv sometimes overfilled the first column
  See: raspberrypi/userland#465

- firmware: arm_loader: Add SET_NOTIFY_REBOOT message
  See: #968

- firmware: gencmd: Report temperature with read_ring_osc values

- firmware: mmal_ril: Correct portdef assignment for video.eColorFormat
- firmware: variants: Add TGA and PPM codecs
- firmware: imx219: Fix exposure calcs for rounding down

- firmware: sdram: Remove [ad]phy_drv_slew logging spam

- firmware: sdram: Reduce address skew from -10 to -5

- firmware: platform: Avoid improving the schmoo on Pi3+
- firmware: platform: Latest AVS rules
- firmware: sdram: Increase read/write latency for higher sdram frequencies

- firmware: power: Add boot-time 3b+ PMIC register logging
- firmware: power: Continue to probe PMIC after error

- revert: sdram: Reduce address skew from -10 to -5
  See: https://forum.kodi.tv/showthread.php?tid=298461&pid=2740277#pid2740277

- firmware: variant: Disable custom_preproc and focus_stats_preproc camera stages
  See: raspberrypi/linux#2528

- firmware: bootcode: Force an I2C stop as a reset
- firmware: power: Ensure at least 2ms between writes to the PMIC regs
- firmware: power: Add 3ms threshold
- firmware: power: Reduce i2c speed of pmic to 100kHz

- firmware: dtoverlay: More "reg" and "name" support

- firmware: imx219: Updates for production test

- firmware: arm_loader: Update NOTIFY_REBOOT to reset the GPIO expander
  See: #968

- firmware: Allow selection of DSI port for LCD

- firmware: pwm_sdm: fix an edge case when reading back DMA source addresses

- firmware: pwm_sdm: fix write handle refcounting
  See: raspberrypi/linux#2587

- firmware: arm_dt: Protect against seg-fault when dt failed to load

- firmware: isp: Alter logging level for buffer size errors
- firmware: isp: Return output buffers that are too small
- firmware: video_encode: Integrate the ISP for format conversion
- firmware: mmal: Populate buffer->type->video.flags field
- firmware: image_fx: Apply interlacing flags from the plugin to output frames

- firmware: isp: IL compatibility and alignment tweaks
- firmware: IL ISP: Use vc_image instead of reworking own stride checking
- firmware: isp: Minor clean ups
- firmware: dispmanx: Complete the format strings for dispmanx_parse_list
- firmware: IL ISP: Use vc_image instead of reworking own stride checking
- firmware: MMAL/IL: Add support for components to report alignment requirements
@tomsaul
Copy link
Author

tomsaul commented Apr 20, 2020

This seems to be fixed in version (commit 06bc6da Tainted)

@6by9
Copy link
Contributor

6by9 commented Apr 20, 2020

It's a firmware fix, not userland. Any firmware from 18th May 2018 or onwards should have fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants