0

Omxplayer 不会在 Raspberry Pi 上播放使用 FFmpeg 生成的任何视频

我发现这个线程表明有必要包含“-profile baseline -level 3.0”参数:https ://github.com/popcornmix/omxplayer/issues/577

完整的命令是:

ffmpeg -framerate 1/10 -pattern_type glob -i '*.jpg' -c:v libx264 -pix_fmt yuv420p -profile baseline -level 3.0 images.mp4

我这样做了,现在我遇到了间歇性行为。

有时它起作用,有时它不起作用。我无法解释为什么/何时播放或不播放。

我还发现一个线程显示需要升级固件和播放器。我这样做了,但仍然遇到同样的问题。

这是一个例子。第一次玩还行。第二次冻死了。

第一次:创建mp4

(env) pi@raspberrypi:~/mkt $ ffmpeg -framerate 1/10 -pattern_type glob -i 'mensagens/*.jpeg' -c:v libx264 -pix_fmt yuv420p -profile baseline -level 3.0 images.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)
  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  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
Input #0, image2, from 'mensagens/*.jpeg':
  Duration: 00:01:10.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1024x768 [SAR 72:72 DAR 4:3], 0.10 fps, 0.10 tbr, 0.10 tbn, 0.10 tbc
Please use -profile:a or -profile:v, -profile is ambiguous
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x182ad70] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x17b1170] using SAR=1/1
[libx264 @ 0x17b1170] frame MB size (64x48) > level limit (1620)
[libx264 @ 0x17b1170] using cpu capabilities: none!
[libx264 @ 0x17b1170] profile Constrained Baseline, level 3.0
[libx264 @ 0x17b1170] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 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=0 weightp=0 keyint=250 keyint_min=1 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 'images.mp4':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], q=-1--1, 0.10 fps, 16384 tbn, 0.10 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    7 fps=0.7 q=15.0 Lsize=      79kB time=00:01:00.00 bitrate=  10.8kbits/s speed=5.66x    
video:78kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.085207%
[libx264 @ 0x17b1170] frame I:3     Avg QP: 2.03  size: 14789
[libx264 @ 0x17b1170] frame P:4     Avg QP: 5.28  size:  8794
[libx264 @ 0x17b1170] mb I  I16..4: 91.0%  0.0%  9.0%
[libx264 @ 0x17b1170] mb P  I16..4: 26.1%  0.0%  3.8%  P16..4:  3.4%  1.3%  1.0%  0.0%  0.0%    skip:64.4%
[libx264 @ 0x17b1170] coded y,uvDC,uvAC intra: 6.5% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 @ 0x17b1170] i16 v,h,dc,p: 97%  1%  2%  0%
[libx264 @ 0x17b1170] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 19% 20%  4%  3%  4%  3%  3%  3%
[libx264 @ 0x17b1170] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x17b1170] ref P L0: 55.1% 44.9%
[libx264 @ 0x17b1170] kb/s:9.09

第一次播放mp4(播放正常):

(env) pi@raspberrypi:~/mkt $ omxplayer images.mp4 
Invalid framerate 0, using forced 25fps and just trust timestamps
Video codec omx-h264 width 1024 height 768 profile 578 fps 25.000000
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1024x768@0.10 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
have a nice day ;)

第二次创建 mp4(没有任何变化):

(env) pi@raspberrypi:~/mkt $ ffmpeg -framerate 1/10 -pattern_type glob -i 'mensagens/*.jpeg' -c:v libx264 -pix_fmt yuv420p -profile baseline -level 3.0 images.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)
  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  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
Input #0, image2, from 'mensagens/*.jpeg':
  Duration: 00:01:10.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1024x768 [SAR 72:72 DAR 4:3], 0.10 fps, 0.10 tbr, 0.10 tbn, 0.10 tbc
Please use -profile:a or -profile:v, -profile is ambiguous
File 'images.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x1c5fd70] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x1be6170] using SAR=1/1
[libx264 @ 0x1be6170] frame MB size (64x48) > level limit (1620)
[libx264 @ 0x1be6170] using cpu capabilities: none!
[libx264 @ 0x1be6170] profile Constrained Baseline, level 3.0
[libx264 @ 0x1be6170] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 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=0 weightp=0 keyint=250 keyint_min=1 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 'images.mp4':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], q=-1--1, 0.10 fps, 16384 tbn, 0.10 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    7 fps=0.7 q=15.0 Lsize=      79kB time=00:01:00.00 bitrate=  10.8kbits/s speed=5.78x    
video:78kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.085207%
[libx264 @ 0x1be6170] frame I:3     Avg QP: 2.03  size: 14789
[libx264 @ 0x1be6170] frame P:4     Avg QP: 5.28  size:  8794
[libx264 @ 0x1be6170] mb I  I16..4: 91.0%  0.0%  9.0%
[libx264 @ 0x1be6170] mb P  I16..4: 26.1%  0.0%  3.8%  P16..4:  3.4%  1.3%  1.0%  0.0%  0.0%    skip:64.4%
[libx264 @ 0x1be6170] coded y,uvDC,uvAC intra: 6.5% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 @ 0x1be6170] i16 v,h,dc,p: 97%  1%  2%  0%
[libx264 @ 0x1be6170] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 19% 20%  4%  3%  4%  3%  3%  3%
[libx264 @ 0x1be6170] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x1be6170] ref P L0: 55.1% 44.9%
[libx264 @ 0x1be6170] kb/s:9.09

第二次播放 mp4(它冻结了。我不得不 ctrl-c 打断):

(env) pi@raspberrypi:~/mkt $ omxplayer images.mp4 
Invalid framerate 0, using forced 25fps and just trust timestamps
Video codec omx-h264 width 1024 height 768 profile 578 fps 25.000000
Subtitle count: 0, state: off, index: 1, delay: 0
Stopped at: 00:00:00
have a nice day ;)
4

1 回答 1

0

大多数玩家不喜欢这么低的帧率。添加-r 10输出选项:

ffmpeg -framerate 1/10 -pattern_type glob -i 'mensagens/*.jpeg' -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -r 10 images.mp4
  • 您不必-r 10专门使用。这是一个任意的例子,对于大多数玩家来说应该足够高,但可以随意尝试。

  • 帧将被复制以从 1/10 变为 10,但输出看起来相同并以正确的速度播放。

  • 您可能不需要-level,或者至少不需要3.0(您的输入属性无论如何都超过了)。你甚至可能不需要-profile:v,或者尝试一下-profile:v main

于 2020-12-31T18:55:35.470 回答