How to play media file in embedded Linux with ffplay?
1
vote
0
answers
782
views
I am currently working on an embedded Linux system (kernel-5.10.24) that includes an LCD and a speaker.
At the moment, I am testing the playback of media files using ffmpeg and ffplay, without utilizing SDL. Initially, I attempted the following approach and encountered an error.
# ffplay /test.mp4
ffplay version 4.2.2 Copyright (c) 2003-2019 the FFmpeg testers
built with gcc 7.2.0 (GNU Linux-Release5.0.0.0-Default(ARMv5))
configuration: --enable-cross-compile --cross-prefix=/test/armv5/gitdir/linux_gnu_armv5/out/product/fooarmv5.tea5.10-eng/obj/bin/arm-linux-gnu- --sysroot=/test/armv5/gitdir/linux_gnu_armv5/out/product/fooarmv5.tea5.10-eng/obj/host/arm-linux-gnu/sysroot --host-cc=/usr/bin/gcc --arch=arm --target-os=linux --disable-stripping --pkg-config=/test/armv5/gitdir/linux_gnu_armv5/out/product/fooarmv5.tea5.10-eng/obj/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid --disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --disable-gpl --disable-nonfree --enable-ffmpeg --enable-ffplay --enable-avresample --disable-ffprobe --disable-libxcb --disable-postproc --enable-swscale --enable-indevs --enable-alsa --enable-outdevs --enable-pthreads --enable-zlib --enable-lzo --disable-bzlib --disable-libfdk-aac --disable-libcdio --disable-gnutls --enable-openssl --enable-libdrm --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-mmal --disable-omx --disable-omx-rpi --disable-libopencv --disable-libopus --disable-libvpx --disable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --disable-libtheora --disable-libwavpack --disable-iconv --enable-libfreetype --disable-fontconfig --disable-libopenjpeg --disable-libx264 --disable-libx265 --disable-libdav1d --disable-libvo_amrwbenc --disable-libopencore-amrwb --disable-x86asm --disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --disable-armv6 --disable-armv6t2 --disable-vfp --disable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=armv5
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
Could not initialize SDL - No available video device
(Did you set the DISPLAY variable?)
And I got the same error when run ffplay /test.mp4
.
But I can play the video with ffmpeg -re -i /test.mp4 -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
.
There is NO libSDL or X in this embedded system.
So how can I play the MP4 with ffplay
?
Even more, how to play the MP3 file with ffplay
in the system ?
#### Tried with mpv.
# mpv -vo help
Available video outputs:
libmpv render API for libmpv
gpu Shader-based GPU Renderer
null Null video output
image Write video frames to image files
tct true-color terminals
drm Direct Rendering Manager
Segmentation fault
Then tried to play mp4.
# mpv ./Quad_split.mp4
Compiled without libass.
There will be no OSD and no text subtitles.
Playing: ./test.mp4
(+) Video --vid=1 (*) (h264 852x480 29.895fps)
Error opening/initializing the selected video_out (--vo) device.
Video: no video
No video or audio streams selected.
Exiting... (Errors when loading file)
Segmentation fault
I did NOT find /dev/fb, so I tried followings,
# mpv --vo image /root/test.mp4
Compiled without libass.
There will be no OSD and no text subtitles.
Playing: /root/test.mp4
(+) Video --vid=1 (*) (h264 852x480 29.895fps)
VO: [image] 852x480 yuv420p
[vo/image] Saving 00000001.jpg
V: 00:00:00 / 00:00:09 (0%)
[vo/image] Saving 00000002.jpg
V: 00:00:00 / 00:00:09 (1%)
[vo/image] Saving 00000003.jpg
V: 00:00:00 / 00:00:09 (1%)
[vo/image] Saving 00000004.jpg
V: 00:00:00 / 00:00:09 (1%)
[vo/image] Saving 00000005.jpg
V: 00:00:00 / 00:00:09 (2%)
[vo/image] Saving 00000006.jpg
V: 00:00:00 / 00:00:09 (2%)
[vo/image] Saving 00000007.jpg
V: 00:00:00 / 00:00:09 (2%)
[vo/image] Saving 00000008.jpg
There are lots of JPG files generated in the current directory, which showed the mpv
can work to some extent.
So how to make mpv
to work in this embedded system (without X and VT)? Does it need to do some coding with libmpv to play the video on /dev/fb
?
Asked by wangt13
(631 rep)
May 30, 2023, 09:51 AM
Last activity: May 30, 2023, 11:47 PM
Last activity: May 30, 2023, 11:47 PM