# \[beta testing\] nodes for live streaming mp4

**URL:** <https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743>\
**Category:** Share Your Nodes\
**Created:** [4 October 2020 23:35 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743 "2020-10-04T23:35:12Z")\
**Posts on this page:** 20\
**Page:** 8

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [19 November 2020 14:06 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/141 "2020-11-19T14:06:03Z")

</div>

> [@kevinGodell](#):
>
> Now, it is processing 2 segments every second, which is a rate increase x 4.

Considering this, the little RPi is doing all right I think 😃

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [19 November 2020 16:54 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/142 "2020-11-19T16:54:49Z")

</div>

> [@kevinGodell](#):
>
> We are changing the movflags and adding min\_frag\_duration:  
> `-movflags +frag_every_frame+empty_moov+default_base_moof -min_frag_duration 500000`

This is the old working , end of the ffmpeg command :

```auto
-c:a aac -c:v copy -f mp4 -movflags +frag_keyframe+empty_moov+default_base_moof pipe:1

```

Now , i change like you said :

```auto
-c:a aac -c:v copy -f mp4 -movflags +frag_every_frame+empty_moov+default_base_moof -min_frag_duration 500000 pipe:1

```

BUT I have no flow ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/6/d6603f3d5fa9c6d4d4075570d6bea44e39eb7e89.png) . Can you tell me where the fault is in my mpeg command ?

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [19 November 2020 17:14 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/143 "2020-11-19T17:14:07Z")

</div>

I believe you already did also??  
cd .node-red  
npm update

---

<div class="post-metadata">

**Author:** ![kevinGodell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kevingodell/32/27040_2.png) [@kevinGodell](https://discourse.nodered.org/u/kevinGodell)\
**Post date:** [19 November 2020 18:14 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/144 "2020-11-19T18:14:13Z")

</div>

It may be possible that new movflag may not be in your version of ffmpeg. It was added sometime during 2018.

Can you run this command and see if it shows frag\_every\_frame listed?

```auto
ffmpeg -h muxer=mp4

```

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [19 November 2020 18:24 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/145 "2020-11-19T18:24:59Z")

</div>

> [@kevinGodell](#):
>
> ```auto
> cd .node-red
> npm update
> 
> ```

I did it again just in case, but it's the same

> [@kevinGodell](#):
>
> Can you run this command and see if it shows frag\_every\_frame listed?

`ffmpeg version 3.2.15-0+deb9u1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516`  
indeed, I can't find a : frag\_every\_frame 🙄

[EDIT] I tried this: `sudo apt-get update && sudo apt-get install ffmpeg ` and return : `ffmpeg is already the newest version (7:3.2.15-0+deb9u1).`

---

<div class="post-metadata">

**Author:** ![kevinGodell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kevingodell/32/27040_2.png) [@kevinGodell](https://discourse.nodered.org/u/kevinGodell)\
**Post date:** [20 November 2020 00:16 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/146 "2020-11-20T00:16:56Z")

</div>

> [@SuperNinja](#):
>
> ffmpeg version 3.2.15-0+deb9u1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516

The command `ffmpeg -h muxer=mp4` should have given much output pertaining to the mp4 container. But looking at what seems like a timestamp, 20170516 from your ffmpeg, perhaps that is the date. Your version seems that maybe it is too old if it is from 2017, since I think the feature may have been added in 2018.

pi@raspberrypi:~ $ ffmpeg -h muxer=mp4  
ffmpeg version 4.1.6-1~deb10u1+rpt1 Copyright (c) 2000-2020 the FFmpeg developers  
built with gcc 8 (Raspbian 8.3.0-6+rpi1)  
...  
mp4 muxer AVOptions:  
-movflags E........ MOV muxer flags (default 0)  
rtphint E........ Add RTP hint tracks  
empty\_moov E........ Make the initial moov atom empty  
frag\_keyframe E........ Fragment at video keyframes  
frag\_every\_frame E........ Fragment at every frame  
...

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [20 November 2020 08:06 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/147 "2020-11-20T08:06:23Z")

</div>

yes excuse me I was not clear. I do `ffmpeg -h muxer=mp4` and have a long list of ffmpeg capabilities, but unfortunately "frag\_every\_frame" **is missing in the list**. Because of my old version of ffmpeg.

Obviously, I cannot do a "simple" update because it indicates that I am already on the last version `ffmpeg is already the newest version (7: 3.2.15-0 + deb9u1)` while you are at the `4.1.6-1`

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 November 2020 08:13 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/148 "2020-11-20T08:13:12Z")

</div>

Which version of Debian are you on ? Ffmpeg 4 should be part of buster

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [20 November 2020 08:18 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/149 "2020-11-20T08:18:32Z")

</div>

**for my part, I am on my RPI3B:**

```auto
pi@pi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

```

my RPI3B is too old to update 😭 😄

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 November 2020 08:19 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/150 "2020-11-20T08:19:14Z")

</div>

No it isn’t. Buster runs fine on all pi

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [20 November 2020 08:21 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/151 "2020-11-20T08:21:24Z")

</div>

I digress a bit from the subject: I did not find the command to update from Stretch to Buster. Do i have to completely re-flash the SD card?

[EDIT] ifound [https://www.raspberrypi.org/blog/buster-the-new-version-of-raspbian/](https://www.raspberrypi.org/blog/buster-the-new-version-of-raspbian/)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 November 2020 08:34 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/152 "2020-11-20T08:34:27Z")

</div>

see - [https://www.makeuseof.com/tag/raspberry-pi-update-raspbian-os/](https://www.makeuseof.com/tag/raspberry-pi-update-raspbian-os/)

---

<div class="post-metadata">

**Author:** ![wb666greene](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wb666greene/32/6534_2.png) [@wb666greene](https://discourse.nodered.org/u/wb666greene)\
**Post date:** [20 November 2020 16:20 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/153 "2020-11-20T16:20:19Z")

</div>

My advice, SD cards are pretty cheap these days, start fresh with a new card, then you can return to your original system if necessary.

I'm usually grateful to have had the old system available, as I seem to always forget something, being able to go back at look at what I changed in /etc or retrieve something from /home/pi has always more than justified the cost of a fresh SD card.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [21 November 2020 06:19 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/154 "2020-11-21T06:19:44Z")

</div>

I have indeed upgraded several RPi3's from Stretch to Buster succesfully following the steps listed in the article linked to by @dceejay. It has worked all the time (I even upgraded a few from Jessie -\> Stretch -\> Buster following the same principles).

However, I really recommend to make a backup of the SD card before moving on. In all my RPi's I do have a permanent connected microSDcard reader with an additional SD card inserted. When I make a "major" change of something, I always run the easy to use "SD Card Copier" tool. This will save my hard work the day an active SD card eventually would die (I have also tested this, it creates a perfect clone, swapping the SD cards works fine, the RPi boots up and runs exactly as expected with the clone inserted)

EDIT: Also checked one of my upgraded RPi's, for sure ffmpeg ver 4 was there, it's not the latest but "good enough":

```auto
ffmpeg version 4.1.4-1+rpt7~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers

  libavutil 56. 22.100 / 56. 22.100
  libavcodec 58. 35.100 / 58. 35.100
  libavformat 58. 20.100 / 58. 20.100
  libavdevice 58. 5.100 / 58. 5.100
  libavfilter 7. 40.101 / 7. 40.101
  libavresample 4. 0. 0 / 4. 0. 0
  libswscale 5. 3.100 / 5. 3.100
  libswresample 3. 3.100 / 3. 3.100
  libpostproc 55. 3.100 / 55. 3.100
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
    Common extensions: mp4.
    Mime type: video/mp4.
    Default video codec: h264.
    Default audio codec: aac.
mp4 muxer AVOptions:
  -movflags <flags> E........ MOV muxer flags (default 0)
     rtphint E........ Add RTP hint tracks
     empty_moov E........ Make the initial moov atom empty
     frag_keyframe E........ Fragment at video keyframes
     frag_every_frame E........ Fragment at every frame
     separate_moof E........ Write separate moof/mdat atoms for e

```

In one of my RPi's I decided to build from source so here I have a newer version (but I guess both would work)

```auto
ffmpeg version N-99578-gaf701196ec Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --extra-ldflags=-latomic --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-libx264 --enable-nonfree
  libavutil 56. 60.100 / 56. 60.100
  libavcodec 58.111.101 / 58.111.101
  libavformat 58. 62.100 / 58. 62.100
  libavdevice 58. 11.102 / 58. 11.102
  libavfilter 7. 87.100 / 7. 87.100
  libswscale 5. 8.100 / 5. 8.100
  libswresample 3. 8.100 / 3. 8.100
  libpostproc 55. 8.100 / 55. 8.100
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
    Common extensions: mp4.
    Mime type: video/mp4.
    Default video codec: h264.
    Default audio codec: aac.
mp4 muxer AVOptions:
  -movflags <flags> E......... MOV muxer flags (default 0)
     rtphint E......... Add RTP hint tracks
     empty_moov E......... Make the initial moov atom empty
     frag_keyframe E......... Fragment at video keyframes
     frag_every_frame E......... Fragment at every frame
     separate_moof E......... Write separate moof/mdat atoms for 

```

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [21 November 2020 09:29 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/155 "2020-11-21T09:29:53Z")

</div>

@dceejay @wb666greene @krambriw what happened. RPI down! I was optimistic 😁

> [@Problem after updating Raspbian Stretch to Buster](https://discourse.nodered.org/t/problem-after-updating-raspbian-stretch-to-buster/36278):
>
> @dceejay @wb666greene @krambriw I updated my RPI 3B with this tutorial : [Stretch to Buster Raspbian](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/152) The problem is, I can't access Node Red anymore. It seems that the update did not work well. Secund problem i'm not Linux specialist ... It looks like the update didn't work well because I can't see an IP address. i test ifconfig Sorry for bad photo quality , even SSH not working. it's the kitchen TV laughing i test the hostname -i return 127.0.1.1

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [21 November 2020 10:40 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/156 "2020-11-21T10:40:04Z")

</div>

ok i got it : `frag_every_frame` is here after Buster update 🙂

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [21 November 2020 12:49 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/157 "2020-11-21T12:49:27Z")

</div>

> [@kevinGodell](#):
>
> So now, I just shaved about 2 seconds realtime delay off my ip cams at my house

After a lot of fright I updated my RPI3B with Buster (thanks to @dceejay ), ffmpeg is on version 4, and I can use your new command of "frag\_every\_frame" and the **result is perfect** :  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c751471cfe32f67fa20fcbfac8e86bc11fcd06e.png)

**UNLESS** I lose the signal, I lose 7 seconds which will not be caught automatically.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcc2f2c66a1a49dac60664e55830e935c55291cf.png)

I indicate that the camera is in wifi, where it is I cannot pull an ethernet cable.  
Losing the connection for a few seconds is not dramatic, the ideal would be to speed up the video to find real time. Too bad for the fluidity if it happens a few times a day it goes unnoticed.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [21 November 2020 14:15 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/158 "2020-11-21T14:15:19Z")

</div>

> [@SuperNinja](#):
>
> I lose the signal, I lose 7 seconds which will not be caught automatically

I do not understand this fully, just for my understanding:

- the camera connection is lost, say 7 seconds
- then connection is back and streaming works again
- time showed is 7 seconds "behind"

Are you sure also video is behind and not only showed time is "wrong" ??

I mean, if the camera connection is lost, there is not possible that frames are transferred and shown later as "behind" or delayed?? Maybe is the node that is "stopping" time counting and when frames are coming again, continuos showing time from when frames stopped arriving?? Therefore a 7 second lost connection will show as 7 second behind? But this is just a guess

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [21 November 2020 14:27 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/159 "2020-11-21T14:27:44Z")

</div>

My reference stream is the one played by VLC because it is the one that plays the video without any delay compared to the original streamming of the IP camera (Android app, CMS, IP camera client on browser).

So, if I put VLC side by side and the UI\_MP4FRAG (of our friend Kevin 😉) , when I lose the signal (weak wifi):

- VLC stops a few seconds and accelerates the video to resume real time
- UI\_MP4FRAG "turns in circles" waiting for the return of the signal, then resume reading but late compared to VLC.

In this example I am in the worst case, in FHD so the wifi signal is in difficulty and yes, the accumulated delay went up to 7s "behind" compared to VLC.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [21 November 2020 14:34 UTC](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/160 "2020-11-21T14:34:23Z")

</div>

Aha, understood, so the acceleation is the point (or simply skipping frames to start just to catch up with "live video"??)

[Previous page](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743.md?page=7)

[Next page](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743.md?page=9)
