Running out of RAM when copying 1080p H264 stream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Running out of RAM when copying 1080p H264 stream

Tom Holmes
Hi,

I'm trying to copy an H264 1920x1080 video only stream from a USB camera
and save to microSD using an OpenWRT based  MT7688 SoC Microprocessor
(Onion Omega2+ 128MB RAM). This works fine for up to 1280x720 (roughly
2.9Mb/s) but when I increase resolution the os kills ffmpeg due to RAM. I
can successfully copy the mjpeg stream at 1280x720 (around 30Mb/s) but
again any higher resolution gets killed. I would have thought that if the
mjpeg stream works, then the much lower bitrate H.264 stream would work
fine. Any hints on how to get around this? Command line options to try?
Hoping to avoid cross compiling but that's the backup plan.

Thanks,
Tom
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Running out of RAM when copying 1080p H264 stream

Carl Eugen Hoyos-2
2018-06-30 22:20 GMT+02:00, Tom Holmes <[hidden email]>:

> I'm trying to copy an H264 1920x1080 video only stream
> from a USB camera and save to microSD using an
> OpenWRT based  MT7688 SoC Microprocessor (Onion
> Omega2+ 128MB RAM). This works fine for up to
> 1280x720 (roughly 2.9Mb/s) but when I increase
> resolution the os kills ffmpeg due to RAM.

Please provide the command line you tested together
with the complete, uncut console output.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Running out of RAM when copying 1080p H264 stream

Tom Holmes
Hi,

ffmpeg -f v4l2 -s 1920x1080 -v trace -r 5 -input_format h264 -i /dev/video0
-c:v copy /tmp/mounts/SD-P1/test.mp4 -y 1&> ffmpeg.log

see dmesg output here
<https://docs.google.com/document/d/15J8RqzrAXmAEadqs2hMIPrD9-NaSvs1k28Ay1INYfNs/edit?usp=sharing>
showing
call trace

ffmpeg.log:

ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (LEDE GCC 5.4.0 r3102-0224e32)
  configuration: --enable-cross-compile
--cross-prefix=mipsel-openwrt-linux-musl- --arch=mipsel --target-os=linux
--prefix=/usr --pkg-config=pkg-config --enable-shared --enable-static
--enable-small --enable-pthreads --enable-zlib --disable-doc
--disable-debug --enable-gpl --enable-version3 --disable-dxva2
--disable-lzma --disable-vaapi --disable-vda --disable-vdpau
--disable-outdevs --disable-altivec --disable-vsx --disable-power8
--disable-amd3dnow --disable-amd3dnowext --disable-mmx --disable-mmxext
--disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4
--disable-sse42 --disable-avx --disable-xop --disable-fma3 --disable-fma4
--disable-avx2 --disable-aesni --disable-armv5te --disable-armv6
--disable-armv6t2 --disable-inline-asm --disable-mipsdsp
--disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-mmi
--disable-fast-unaligned --disable-runtime-cpudetect --disable-yasm
--enable-libopus --enable-decoder=libopus --enable-libx264
--enable-libmp3lame
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument
'v4l2'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1920x1080'.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'trace'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '5'.
Reading option '-input_format' ... matched as AVOption 'input_format' with
argument 'h264'.
Reading option '-i' ... matched as input url with argument '/dev/video0'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option '/tmp/mounts/SD-P1/test.mp4' ... matched as output url.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument trace.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /dev/video0.
Applying option f (force format) with argument v4l2.
Applying option s (set frame size (WxH or abbreviation)) with argument
1920x1080.
Applying option r (set frame rate (Hz value, fraction or abbreviation))
with argument 5.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x761248b0] fd:3 capabilities:84200001
[video4linux2,v4l2 @ 0x761248b0] Current input_channel: 0, input_name:
Camera 1, input_std: 0
[video4linux2,v4l2 @ 0x761248b0] Setting time per frame to 1/5
Killed


Thanks,
Tom

[image: Kamahi Electronics]
*Tom Holmes* ELECTRONICS ENGINEER
[hidden email]
+64 3 481 1884
kamahi.com


On Sun, Jul 1, 2018 at 8:37 AM Carl Eugen Hoyos <[hidden email]> wrote:

> 2018-06-30 22:20 GMT+02:00, Tom Holmes <[hidden email]>:
>
> > I'm trying to copy an H264 1920x1080 video only stream
> > from a USB camera and save to microSD using an
> > OpenWRT based  MT7688 SoC Microprocessor (Onion
> > Omega2+ 128MB RAM). This works fine for up to
> > 1280x720 (roughly 2.9Mb/s) but when I increase
> > resolution the os kills ffmpeg due to RAM.
>
> Please provide the command line you tested together
> with the complete, uncut console output.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Running out of RAM when copying 1080p H264 stream

Carl Eugen Hoyos-2
2018-07-01 23:00 GMT+02:00, Tom Holmes <[hidden email]>:

> ffmpeg -f v4l2 -s 1920x1080 -v trace -r 5 -input_format h264
> -i /dev/video0 -c:v copy /tmp/mounts/SD-P1/test.mp4

Probably unrelated:
The input option "-r" is wrong here, use "-framerate", this is
mentioned in the documentation.
The command line should not have a big memory impact,
could the issue be the v4l2 driver?

> ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers

This is old and unsupported, please also test current FFmpeg
git head.

>   built with gcc 5.4.0 (LEDE GCC 5.4.0 r3102-0224e32)
>   configuration: --enable-cross-compile
> --cross-prefix=mipsel-openwrt-linux-musl- --arch=mipsel --target-os=linux
> --prefix=/usr --pkg-config=pkg-config --enable-shared --enable-static
> --enable-small --enable-pthreads --enable-zlib --disable-doc
> --disable-debug --enable-gpl --enable-version3 --disable-dxva2
> --disable-lzma --disable-vaapi --disable-vda --disable-vdpau
> --disable-outdevs --disable-altivec --disable-vsx --disable-power8
> --disable-amd3dnow --disable-amd3dnowext --disable-mmx --disable-mmxext
> --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4
> --disable-sse42 --disable-avx --disable-xop --disable-fma3 --disable-fma4
> --disable-avx2 --disable-aesni --disable-armv5te --disable-armv6
> --disable-armv6t2 --disable-inline-asm --disable-mipsdsp
> --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-mmi
> --disable-fast-unaligned --disable-runtime-cpudetect --disable-yasm
> --enable-libopus --enable-decoder=libopus --enable-libx264
> --enable-libmp3lame

To make debugging easier, start with removing all "--disable-" option,
especially the ones that make no sense whatsoever (--disable-power8,
seriously? I didn't even know this exists). --disable-runtime-cpudetect
does not do what you think it does, please remove it.
To save system memory, start with "--disable-everything
--disable-network" and add the things you need, possibly:
--enable-indev=v4l2 --enable-parser=h264 --enable-muxer=mp4

Please do not top-post here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".