WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Starting FFMPEG at boot  (Read 608 times)

Offline nygauk

  • Newbie
  • *
  • Posts: 8
Starting FFMPEG at boot
« on: February 02, 2026, 04:15:41 PM »
I am having trouble starting ffmpeg from bootlocal.sh, i.e. it will not start - leaving no evidence of attempted execution. It starts ok in .profile but I do not want another instance everytime I log in. Can anyone help? Thanks. (•‿•)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #1 on: February 02, 2026, 04:31:30 PM »
Hi nygauk
You need to post more details than that to receive good answers.

For instance, if you are trying to stream over the network, are you
sure the network is already up?

Maybe if you post the command you are using, it will provide a clue.

Offline Leee

  • Full Member
  • ***
  • Posts: 200
Re: Starting FFMPEG at boot
« Reply #2 on: February 02, 2026, 04:46:53 PM »
Remember that bootlocal.sh runs as root, whereas .profile (for user tc) runs as user tc.  So, in addition to possible timing issues ("network not up yet" and such), the effective user might be an issue.
core 16.0 x86_64

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #3 on: February 02, 2026, 05:07:07 PM »
Hi nygauk
Leees comment reminds me of something else. You might have
to specify the path when running from bootlocal.sh.

You may have to start it like this:
Code: [Select]
/usr/local/bin/ffmpeg
instead of just:
Code: [Select]
ffmpeg

Offline nygauk

  • Newbie
  • *
  • Posts: 8
Re: Starting FFMPEG at boot
« Reply #4 on: February 02, 2026, 05:22:16 PM »
Thanks for your helpful replies. I have tried all possibilities re users, absolute paths but to no avail. I am streaming video from an ip camera, and all that works fine. I have isolated down to a basic problem, i.e

If I add to the bottom of bootlocal.sh:
Code: [Select]
ls -l  /usr/local/bin/ffmpeg > /home/tc/test.txt - I can see ffmpeg in its directory.

However, if I add:
Code: [Select]
/usr/local/bin/ffmpeg > /home/tc/test.txt - test .txt is empty when it should contain the ffmpeg info spiel. Alas nothing!

Thanks

    [Edit]: Added code tags.  Rich
« Last Edit: February 02, 2026, 06:25:18 PM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #5 on: February 02, 2026, 05:29:25 PM »
Hi nygauk
Do you get anything if you do it like this:
Code: [Select]
/usr/local/bin/ffmpeg > /home/tc/test.txt 2>&1

Offline Leee

  • Full Member
  • ***
  • Posts: 200
Re: Starting FFMPEG at boot
« Reply #6 on: February 02, 2026, 05:38:04 PM »
@Rich:  I note that all of the ffmpeg* extensions in the 17.x x86_64 repo have .info files that include the tag "covert" and I suspect it ought to be "convert".  I don't use ffmpeg enough to know if there's anything "sneaky" about it but....
core 16.0 x86_64

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #7 on: February 02, 2026, 05:45:27 PM »
Hi Leee
I noticed the same thing when using Apps in TC14 x86_64.
I'll look into it later tonight. I'm pretty sure it should be  convert.  :)


Offline nygauk

  • Newbie
  • *
  • Posts: 8
Re: Starting FFMPEG at boot
« Reply #8 on: February 02, 2026, 06:13:15 PM »
Hi again

I have solved it via .profile. To prevent multiple instances I have inserted this snippet:
Code: [Select]
if [ ! -e /tmp/c1_rec.running ]; then
  /usr/bin/sudo /home/tc/cgi-bin/c1_rec.sh
  sudo touch /tmp/c1_rec.running
fi

That'll do me (•‿•)

Thanks

    [Edit]: Added code tags.  Rich
« Last Edit: February 02, 2026, 06:25:42 PM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #9 on: February 02, 2026, 06:26:04 PM »
Hi nygauk

Please use  Code Tags  when posting commands and responses seen in a terminal. To use  Code Tags  click on the  #  icon
above the reply box and paste your text between the  Code Tags  as shown in this example:

Quote
[code][   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517[/code]

It will appear like this in your post:
Code: [Select]
[   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517

Code Tags  serve as visual markers between what you are trying to say and the information you are posting. They also preserve
spacing so column aligned data displays properly. Code tags also automatically add horizontal and or vertical scrollbars
to accommodate long lines and listings.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #10 on: February 02, 2026, 06:26:17 PM »
Hi nygauk
Good job. That's one of the nice things about Linux. So many
ways of solving the same problem.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #11 on: February 02, 2026, 06:26:33 PM »
Hi Leee
I fixed the typos in TC14 through TC17 for both x86 and x86_64.

Offline nygauk

  • Newbie
  • *
  • Posts: 8
Re: Starting FFMPEG at boot
« Reply #12 on: February 02, 2026, 06:53:45 PM »
Solved - thanks  Rich and Leee

Using  2>&1 I discovered the network is not up yet, i.e.
"[tcp @ 0x9570400] Connection to tcp://192.168.1.21:554?timeout=0 failed: No route to host"

As I mentioned I solved it via .profile. Works great!

Tinycore is a great distribution and a brilliant concept. I love it for all sorts of reasons.

Thanks again. David (from up North in the UK)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 12561
Re: Starting FFMPEG at boot
« Reply #13 on: February 02, 2026, 08:21:54 PM »
Hi nygauk
Placing this at the end of your bootlocal.sh should work too:
Code: [Select]
CNT=0
until ifconfig | grep -q Bcast
do
    [ $((CNT++)) -gt 60 ] && break || sleep 1
done

# Place your ffmpeg command here.
It will wait up to 60 seconds or until your network is up
before executing your ffmpeg command.

Like I said "So many ways of solving the same problem."

Offline nygauk

  • Newbie
  • *
  • Posts: 8
Re: Starting FFMPEG at boot
« Reply #14 on: February 06, 2026, 07:42:50 AM »
I don't like waiting, but this snippet broadens my tc knowledge, and I have saved it for possible future use. I will try it out; thank you Rich; there doesn't seem to be a thumbs up emoji so (•‿•)