User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 9:00 am

Hello,

I've been struggling with having FFmpeg run on Pi Zero W, as a newbie I can't say where the root of the problem whether its the compilation configuration of the FFmpeg or maybe the syntax of the command line itself..

The current configuration is:

Raspberry Pi Zero Wireless
Set GPU memory to 256

Running OS:
Linux raspberrypi 4.19.66+ #1253 Thu Aug 15 11:37:30 BST 2019 armv6l GNU/Linux

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
FFmpeg version and configuration:
ffmpeg version N-94582-gd0fa1a58da Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-omx --enable-omx-rpi --enable-nonfree
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 31.101 / 58. 31.101
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Hyper fast Audio and Video encoder
Command to copy 30 seconds clip from the 10 second mark:

Code: Select all

sudo ffmpeg -ss 00:00:10 -t 00:00:30 -i GOPR2546.MP4 -c:v libx264 -c:a copy out.MP4
The FFmpeg output:
ffmpeg version N-94582-gd0fa1a58da Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-omx --enable-omx-rpi --enable-nonfree
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 31.101 / 58. 31.101
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x210d360] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR2546.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-08-20T11:09:41.000000Z
firmware : HD7.01.01.80.00
Duration: 00:01:00.84, start: 0.000000, bitrate: 45293 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45043 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 11:20:21:32
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AAC
timecode : 11:20:21:32
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro TCD
timecode : 11:20:21:32
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 41 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro SOS
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Illegal instruction
The result is an empty out.MP4 file... I've tried different configuration but never got it to work.

the one minute input file i'm using to test can be downloaded here

Thank you all in advance!!
Ram

User avatar
rpdom
Posts: 15615
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 10:05 am

I think the problem may be that you are compiling for armel where Raspbian is armhf. However you will have to specify the particular CPU type. Doing a quick seach on "raspberrypi compiler options" suggests "-mcpu=arm1176jzf-s -mfpu=vfp" may help give the optimal working configuration.

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 11:30 am

Ram.Sh wrote:
Tue Aug 20, 2019 9:00 am
Hello,

I've been struggling with having FFmpeg run on Pi Zero W, as a newbie I can't say where the root of the problem whether its the compilation configuration of the FFmpeg or maybe the syntax of the command line itself..

The current configuration is:

Raspberry Pi Zero Wireless
Set GPU memory to 256

Running OS:
Linux raspberrypi 4.19.66+ #1253 Thu Aug 15 11:37:30 BST 2019 armv6l GNU/Linux

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
FFmpeg version and configuration:
ffmpeg version N-94582-gd0fa1a58da Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-omx --enable-omx-rpi --enable-nonfree
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 31.101 / 58. 31.101
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Hyper fast Audio and Video encoder
Command to copy 30 seconds clip from the 10 second mark:

Code: Select all

sudo ffmpeg -ss 00:00:10 -t 00:00:30 -i GOPR2546.MP4 -c:v libx264 -c:a copy out.MP4
The FFmpeg output:
ffmpeg version N-94582-gd0fa1a58da Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-omx --enable-omx-rpi --enable-nonfree
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 31.101 / 58. 31.101
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x210d360] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR2546.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-08-20T11:09:41.000000Z
firmware : HD7.01.01.80.00
Duration: 00:01:00.84, start: 0.000000, bitrate: 45293 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45043 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 11:20:21:32
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AAC
timecode : 11:20:21:32
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro TCD
timecode : 11:20:21:32
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 41 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro SOS
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Illegal instruction
The result is an empty out.MP4 file... I've tried different configuration but never got it to work.

the one minute input file i'm using to test can be downloaded here

Thank you all in advance!!
Ram
Why do you set GPU memory to 256 ?
Why do you use that particular version of ffmpeg and not the raspbian version ?
Why do you use sudo ?

ffmpeg is available in the latest (2019-07-10) Raspbian Buster with desktop but must be installed with apt for Raspbian Buster Lite. The RAM size of the Pi 0 W is 512MB, if you install Raspbian Buster with desktop with GPU=256 the memory is reduced to less than 256 MB, the default size of the swap file is 100 MByte.

With desktop, GPU set to 64MB and swap file to 100 MB using your parameters / file fails because of memory problems.

With desktop, GPU set to 16MB and swap file to 1000 MB using your parameters is so slow that becomes a torture to convert

Code: Select all

frame=  277 fps=0.1 q=31.0 size=     768kB time=00:00:04.61 bitrate=1363.8kbits/s dup=1 drop=0 speed=0.00191x
With CLI, GPU set to 16MB and swap file to 1000 MB using your parameters is a "bit" faster but still no good.

Code: Select all

frame=  187 fps=0.1 q=31.0 size=     512kB time=00:00:03.09 bitrate=1353.7kbits/s dup=1 drop=0 speed=0.00227x
Note I stopped the above jobs because I did not want to wait hours for it to complete.

With Buster Desktop on a Pi3B is only a factor ~25 faster (compared to Pi0W CLI)

Code: Select all

frame= 1800 fps=3.4 q=-1.0 Lsize=    6370kB time=00:00:29.97 bitrate=1740.6kbits/s dup=1 drop=0 speed=0.0573x
With Buster Desktop on a Pi4B/4GB is only a factor ~70 faster (compared to Pi0W CLI) but still too slow (for me)

Code: Select all

frame= 1800 fps=9.5 q=-1.0 Lsize=    6370kB time=00:00:29.97 bitrate=1740.6kbits/s dup=1 drop=0 speed=0.158x
Now something interesting, on a Windows 7 64-Bit, 3.4Mhz Quad Core with Hyperthreading and 16GB RAM

Code: Select all

frame= 1800 fps= 44 q=-1.0 Lsize=    6391kB time=00:00:29.97 bitrate=1746.4kbits/s dup=1 drop=0 speed=0.729x
it is only about 4.6x faster compared to the Pi4B/4GB and 321x faster compared to the Pi0W CLI.

It looks to me that the Pi0W is not powerful enough to do this job, maybe a Pi3A+ might be better if you can wait for the job to complete.
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 12:36 pm

@rpdom, thank you very much for your input!!

I've tried re-configure with the following parameters as your suggestion (is that the correct way?):

added --extra-cflags='-mcpu=-arm1176jzf-s' --extra-ldflags='-mfpu=vfp':

Code: Select all

./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-libx265 --extra-cflags='-mcpu=-arm1176jzf-s' --extra-ldflags='-mfpu=vfp' --enable-omx --enable-omx-rpi --enable-nonfree
changed to --arch=armhf

Code: Select all

./configure --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-libx265 --extra-cflags='-mcpu=-arm1176jzf-s' --extra-ldflags='-mfpu=vfp' --enable-omx --enable-omx-rpi --enable-nonfree
removed --arch

Code: Select all

./configure --target-os=linux --enable-gpl --enable-libx264 --enable-libx265 --extra-cflags='-mcpu=-arm1176jzf-s' --extra-ldflags='-mfpu=vfp' --enable-omx --enable-omx-rpi --enable-nonfree
all options return the following error:
gcc is unable to create an executable file.
C compiler test failed.
re my initial configuration was based on this

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 12:45 pm

@Ernst - thank you for your reply!!
Why do you use that particular version of ffmpeg and not the raspbian version ?
I'm sorry, you mean to tell me that I dont need to spend hours of waiting for the FFmpeg to compile since there's one already installed in the "Raspbian Buster with desktop" version?? man.... do i feel like an idiot right now!

so your recommendation would be to install the Raspbian Buster with desktop version and using the already FFmpeg version in that image and test it from there?

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 1:25 pm

Ram.Sh wrote:
Tue Aug 20, 2019 12:45 pm
so your recommendation would be to install the Raspbian Buster with desktop version and using the already FFmpeg version in that image and test it from there?
Yes, but reduce the GPU memory to 16MB and increase the swap file size in /etc/dphys-swapfile.
Alternatively using Buster Lite you could install ffmpeg with "sudo apt install ffmpeg -y"
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 1:27 pm

Ernst wrote:
Tue Aug 20, 2019 1:25 pm
Ram.Sh wrote:
Tue Aug 20, 2019 12:45 pm
so your recommendation would be to install the Raspbian Buster with desktop version and using the already FFmpeg version in that image and test it from there?
Yes, but reduce the GPU memory to 16MB and increase the swap file size in /etc/dphys-swapfile.
Alternatively using Buster Lite you could install ffmpeg with "sudo apt install ffmpeg -y"
very well, doing it right now, will update once I have news, thanks much!!!

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 3:13 pm

Ram.Sh wrote:
Tue Aug 20, 2019 1:27 pm
Ernst wrote:
Tue Aug 20, 2019 1:25 pm
Ram.Sh wrote:
Tue Aug 20, 2019 12:45 pm
so your recommendation would be to install the Raspbian Buster with desktop version and using the already FFmpeg version in that image and test it from there?
Yes, but reduce the GPU memory to 16MB and increase the swap file size in /etc/dphys-swapfile.
Alternatively using Buster Lite you could install ffmpeg with "sudo apt install ffmpeg -y"
very well, doing it right now, will update once I have news, thanks much!!!
I reinstalled the PI0W with the latest version 2019-07-10 from Raspbian, I reduced the GPU to 16 MB Image

I increased the swap file to 1024 (followed this walk-through)

and the following was my FFmpeg command line:

Code: Select all

pi@raspberrypi:/usr/bin $ sudo ffmpeg -ss 00:00:10 -t 00:00:30 -i "/home/pi/Desktop/jpFiles/GOPR2546.MP4" "/home/pi/Desktop/jpFiles/JoyPro2.mp4"
and the output:
ffmpeg version 4.1.4-1+rpt1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --prefix=/usr --extra-version='1+rpt1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
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
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1b4ee60] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/pi/Desktop/jpFiles/GOPR2546.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-08-20T11:09:41.000000Z
firmware : HD7.01.01.80.00
Duration: 00:01:00.84, start: 0.000000, bitrate: 45293 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45043 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 11:20:21:32
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AAC
timecode : 11:20:21:32
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro TCD
timecode : 11:20:21:32
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 41 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro SOS
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x1b94800] using SAR=1/1
[libx264 @ 0x1b94800] using cpu capabilities: none!
[libx264 @ 0x1b94800] profile High, level 4.2
[libx264 @ 0x1b94800] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/home/pi/Desktop/jpFiles/JoyPro2.mp4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
firmware : HD7.01.01.80.00
encoder : Lavf58.20.100
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 0.02 fps, 60k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AVC
timecode : 11:20:21:32
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2019-08-20T11:09:41.000000Z
handler_name : GoPro AAC
timecode : 11:20:21:32
encoder : Lavc58.35.100 aac
frame= 41 fps=0.5 q=0.0 size= 0kB time=00:00:00.64 bitrate= 0.7kbits/s dup=1 drop=0 speed=0.00803x
the result is stuck on the last line from above and the output file is 1K.

what do you think I'm missing here?

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 3:26 pm

Ram.Sh wrote:
Tue Aug 20, 2019 3:13 pm
what do you think I'm missing here?
Why do you use sudo ?

There are a few possible causes:
1) Are you using a proper power supply or are you using a phone charger ?
2) Is the Pi 0W in a case ? (temperature!)
3) Are you using a quality memory card ?

You must be aware that (this) ffmpeg is a heavy job, this could be causing a heavy load on the power supply and the CPU.
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 3:36 pm

Why do you use sudo ?
when FFmpeg tries to re-write on the same output file it needs permission
1) Are you using a proper power supply or are you using a phone charger ?
I use 2amp 5v charger
2) Is the Pi 0W in a case ? (temperature!)
no, when touching the processor its not hot at all
3) Are you using a quality memory card ?
Samsung 128GB 100MB/s (U3) MicroSDXC Evo Class 10

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Tue Aug 20, 2019 5:25 pm

Ram.Sh wrote:
Tue Aug 20, 2019 3:36 pm
Why do you use sudo ?
when FFmpeg tries to re-write on the same output file it needs permission
use -y instead

Code: Select all

ffmpeg -y -ss 00:00:10 -t 00:00:30 -i "/home/pi/Desktop/jpFiles/GOPR2546.MP4" "/home/pi/Desktop/jpFiles/JoyPro2.mp4"
Ram.Sh wrote:
Tue Aug 20, 2019 3:36 pm
1) Are you using a proper power supply or are you using a phone charger ?
I use 2amp 5v charger
That could be a problem.

FYI, still running:

Code: Select all

 frame=  812 fps=0.1 q=31.0 size=    2560kB time=00:00:13.53 bitrate=1550.0kbits/s dup=1 drop=0 speed=0.00203x
I think it will take a few more hours to complete.
The road to insanity is paved with static ip addresses

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 6:02 am

Job completed in 258m22.403s (6Hrs 18min 22sec)

Code: Select all

frame=  1800 fps=0.1 q=31.0 size=    6739kB time=00:00:29.97 bitrate=1743.2kbits/s dup=1 drop=0 speed=0.00194x
using Raspbian Buster with Desktop, started with console only
on a Pi 0W, 16GB Samsung EVO SD Card, official 5.1V 2.5A power supply
average CPU temperature 57C (idle temperature 40C)
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 6:29 am

thanks so very much for your input!!

something here doesn't make sense to me, in some of my previous (many many) trials where I compiled the FFmpeg by myself on the Pi0W i managed to have it transcode the same video in less than a minute, so I know for a fact that the Pi is capable of handling this much faster than our current results, unfortunately I don't remember which setup I used to compile it and since it didn't support other features I needed I reinstalled other configurations and currently the Buster "Out of the box" version.

in my very humble opinion I guess that the low performance speed is due to the codec currently used?

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 6:38 am

It is very possible that the codec is the performance bottleneck, even on a fast intel PC the performance is not very satisfying.
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 6:45 am

ok then, i'll currently focus on testing different codecs and will update my results here, many thanks for your support!

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 7:32 am

we got major progress!

i installed 264 library

Code: Select all

git clone --depth 1 http://git.videolan.org/git/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make 
sudo make install
i then ran the following command (using the same input file)

Code: Select all

ffmpeg -i "/home/pi/Desktop/jpFiles/GOPR2546.MP4" -vcodec copy "/home/pi/Desktop/jpFiles/JoyPro2.mp4"
FFmpeg did the whole movie in 90 seconds!

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 8:40 am

Ram.Sh wrote:
Wed Aug 21, 2019 7:32 am
we got major progress!

i installed 264 library

Code: Select all

git clone --depth 1 http://git.videolan.org/git/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make 
sudo make install
i then ran the following command (using the same input file)

Code: Select all

ffmpeg -i "/home/pi/Desktop/jpFiles/GOPR2546.MP4" -vcodec copy "/home/pi/Desktop/jpFiles/JoyPro2.mp4"
FFmpeg did the whole movie in 90 seconds!
The reason why is "-vcodec copy", this does not use the codec and therefor installing from a foreign source is unnecessary,
"Stream copy is a mode selected by supplying the "copy" parameter to the -codec option. It makes ffmpeg omit the decoding
and encoding step
for the specified stream, so it does only demuxing and muxing. It is useful for changing the container
format or modifying container-level metadata
."

You could have installed the codec from the raspberry repository.

Code: Select all

pi@raspi7:~ $ sudo apt-cache  search ^x264
libx264-155 - x264 video coding library
x264 - video encoder for the H.264/MPEG-4 AVC standard
In my previous tests I used your original command line as in your first post:

Code: Select all

sudo ffmpeg -ss 00:00:10 -t 00:00:30 -i GOPR2546.MP4 -c:v libx264 -c:a copy out.MP4
which causes the stream to be decoded and encoded, this is very cpu/memory intensive.

With "-vcodec copy":

Code: Select all

pi@raspi7:~ $ ffmpeg -y -i GOPR2546.MP4 -vcodec copy  out.MP4
ffmpeg version 4.1.4-1+rpt1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --prefix=/usr --extra-version='1+rpt1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  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
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x693e40] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR2546.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2019-08-20T11:09:41.000000Z
    firmware        : HD7.01.01.80.00
  Duration: 00:01:00.84, start: 0.000000, bitrate: 45293 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45043 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 11:20:21:32
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AAC
      timecode        : 11:20:21:32
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro TCD
      timecode        : 11:20:21:32
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 41 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro SOS
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : HD7.01.01.80.00
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 45043 kb/s, 0.02 fps, 59.94 tbr, 60k tbn, 60k tbc (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 11:20:21:32
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AAC
      timecode        : 11:20:21:32
      encoder         : Lavc58.35.100 aac
frame= 3646 fps= 38 q=-1.0 Lsize=  335481kB time=00:01:00.84 bitrate=45169.9kbits/s speed=0.637x
video:334460kB audio:953kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.020368%
[aac @ 0x6d9c40] Qavg: 2541.830
pi@raspi7:~ $ time ffmpeg -y -ss 00:00:10 -t 00:00:30  -i GOPR2546.MP4 -vcodec copy  out.MP4
ffmpeg version 4.1.4-1+rpt1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --prefix=/usr --extra-version='1+rpt1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  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
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1043e60] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR2546.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2019-08-20T11:09:41.000000Z
    firmware        : HD7.01.01.80.00
  Duration: 00:01:00.84, start: 0.000000, bitrate: 45293 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45043 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 11:20:21:32
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AAC
      timecode        : 11:20:21:32
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro TCD
      timecode        : 11:20:21:32
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 41 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro SOS
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : HD7.01.01.80.00
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 45043 kb/s, 0.02 fps, 59.94 tbr, 60k tbn, 60k tbc (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 11:20:21:32
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2019-08-20T11:09:41.000000Z
      handler_name    : GoPro AAC
      timecode        : 11:20:21:32
      encoder         : Lavc58.35.100 aac
frame= 1858 fps= 42 q=-1.0 Lsize=  170795kB time=00:00:30.01 bitrate=46613.6kbits/s speed=0.684x
video:170289kB audio:471kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.020468%
[aac @ 0x1089c60] Qavg: 138.181

real    0m51.193s
user    0m15.145s
sys     0m5.349s
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 9:01 am

and I thought i had some progress... bummer.

so if I understand you correctly - when I use the following command which works well and fast

Code: Select all

sudo ffmpeg -y -ss 00:00:10 -i "/home/pi/Desktop/jpFiles/GOPR2546.MP4" -t 00:00:30 -vcodec copy "/home/pi/Desktop/jpFiles/JoyPro2.mp4"
it uses only the Muxer and does not decoding/encoding the input/output files? and if that the case, if I need to have transcoding during the process like reduce frame rate and frame size it would take hours?

Ernst
Posts: 1257
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 9:13 am

Yes
The road to insanity is paved with static ip addresses

User avatar
Ram.Sh
Posts: 32
Joined: Wed Oct 26, 2016 9:14 pm

Re: FFmpeg "Illegal instruction" Raspberry Pi Zero W

Wed Aug 21, 2019 9:13 pm

not happy.


thank you very much for your time, effort, your valuable input and most of all your willingness to help me, i appreciate it much!!

i wish you nothing but the best!
RS.

Return to “Troubleshooting”