Mengubah JPG menjadi MP4 green output


1

Saya mencoba mengonversi JPEG ke MP4 menggunakan ffmpeg. Saya memiliki proses yang berfungsi untuk PNG jadi saya tahu saya menuju jalur yang benar. Dengan ketika ffmpeg selesai memproses JPEG, MP4 yang dihasilkan dapat diputar di smplayer (OpenSuse) menghasilkan tetapi omxplayer (Raspberry Pi) tidak seperti yang diharapkan. Tampaknya memainkan beberapa frame pertama dengan benar, mereka berkedip di layar hampir terlalu cepat untuk dilihat, kemudian memainkan berbagai warna, terutama nuansa hijau, sebagai gambar statis.

Saya sudah mencoba mengonversi JPEG ke PNG sebelum mendorongnya melalui ffmpeg tetapi anehnya itu tidak berhasil. Dugaan saya adalah ada saklar / opsi yang saya butuhkan sehingga ffmpeg akan membangun mp4 dengan format yang memungkinkan omxplayer untuk memutar mp4 dengan benar.

Bagian dalam skrip adalah ...

set -x
echo "Source image: ${SOURCE_IMAGE}" >&2
ffmpeg -loop 1 -pattern_type glob -i "/tmp/${LN_PREFIX}.fade-*.$$.${SOURCE_EXTENSION}" -c:v libx264 ${IMPORT_FORMAT} -t ${DISPLAY_SECONDS} -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -r ${FPS} /tmp/slide.$$.mp4 # 1>/dev/null 2>&1
set +x

Apa yang saya dapatkan sebagai output

Source image: public/user_files/campaigns/5/DSC_0011.JPG
Creating the full length mp4 public/user_files/campaigns/5/DSC_0011.JPG-seconds_15-fade_1.mp4
+ ffmpeg -loop 1 -pattern_type glob -i '/tmp/DSC_0011.JPG.fade-*.2367.JPG' -c:v libx264 -t 15 -vf 'scale=trunc(iw/2)*2:trunc(ih/2)*2' -r 25 /tmp/slide.2367.mp4
ffmpeg version N-79177-ga677121 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --prefix=/usr/local/bin --pkg-config-flags=--static --extra-cflags=-I/home/mike/ffmpeg_build/include --extra-ldflags=-L/home/mike/ffmpeg_build/lib --bindir=/usr/local/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 32.100 / 57. 32.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from '/tmp/DSC_0011.JPG.fade-*.2367.JPG':
  Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 2048x1536, 25 fps, 25 tbr, 25 tbn, 25 tbc
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x2f82e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
[libx264 @ 0x2f82e00] profile High, level 5.0
[libx264 @ 0x2f82e00] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=6 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 '/tmp/slide.2367.mp4':
  Metadata:
    encoder         : Lavf57.29.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 2048x1536, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
  encoder         : Lavc57.32.100 libx264
Side data:
  cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=   19 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=   37 fps= 35 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=   50 fps= 32 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=   62 fps= 30 q=28.0 size=     507kB time=00:00:00.40 bitrate=10386.6kbits/s speed=0.191x    
frame=   75 fps= 29 q=28.0 size=     511kB time=00:00:00.92 bitrate=4546.7kbits/s speed=0.353x    
frame=   89 fps= 29 q=28.0 size=     513kB time=00:00:01.48 bitrate=2841.8kbits/s speed=0.475x    
frame=  104 fps= 29 q=28.0 size=     516kB time=00:00:02.08 bitrate=2032.3kbits/s speed=0.571x    
frame=  118 fps= 28 q=28.0 size=     518kB time=00:00:02.64 bitrate=1607.9kbits/s speed=0.63x    
frame=  133 fps= 28 q=28.0 size=     521kB time=00:00:03.24 bitrate=1316.6kbits/s speed=0.684x    
frame=  148 fps= 28 q=28.0 size=     523kB time=00:00:03.84 bitrate=1116.3kbits/s speed=0.729x    
frame=  162 fps= 28 q=28.0 size=     525kB time=00:00:04.40 bitrate= 978.3kbits/s speed=0.762x    
frame=  175 fps= 28 q=28.0 size=     528kB time=00:00:04.92 bitrate= 878.3kbits/s speed=0.783x    
frame=  190 fps= 28 q=28.0 size=     530kB time=00:00:05.52 bitrate= 786.6kbits/s speed=0.808x    
frame=  205 fps= 28 q=28.0 size=     533kB time=00:00:06.12 bitrate= 712.9kbits/s speed=0.832x    
frame=  219 fps= 28 q=28.0 size=     535kB time=00:00:06.68 bitrate= 655.8kbits/s speed=0.848x    
frame=  234 fps= 28 q=28.0 size=     537kB time=00:00:07.28 bitrate= 604.6kbits/s speed=0.867x    
frame=  248 fps= 28 q=28.0 size=     540kB time=00:00:07.84 bitrate= 564.0kbits/s speed=0.879x    
frame=  263 fps= 28 q=28.0 size=     542kB time=00:00:08.44 bitrate= 526.1kbits/s speed=0.892x    
frame=  278 fps= 28 q=28.0 size=     545kB time=00:00:09.04 bitrate= 493.5kbits/s speed=0.906x    
frame=  291 fps= 28 q=28.0 size=     547kB time=00:00:09.56 bitrate= 468.4kbits/s speed=0.911x    
frame=  302 fps= 27 q=28.0 size=    1190kB time=00:00:10.00 bitrate= 975.0kbits/s speed=0.908x    
frame=  317 fps= 27 q=28.0 size=    1192kB time=00:00:10.60 bitrate= 921.2kbits/s speed=0.919x    
frame=  332 fps= 27 q=28.0 size=    1194kB time=00:00:11.20 bitrate= 873.1kbits/s speed=0.927x    
frame=  348 fps= 28 q=28.0 size=    1196kB time=00:00:11.84 bitrate= 827.2kbits/s speed=0.94x    
frame=  363 fps= 28 q=28.0 size=    1197kB time=00:00:12.44 bitrate= 788.4kbits/s speed=0.948x    
frame=  375 fps= 26 q=-1.0 Lsize=    1209kB time=00:00:14.92 bitrate= 663.9kbits/s speed=1.02x    
video:1204kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.433904%
[libx264 @ 0x2f82e00] frame I:2     Avg QP:17.15  size:583658
[libx264 @ 0x2f82e00] frame P:94    Avg QP:18.65  size:   376
[libx264 @ 0x2f82e00] frame B:279   Avg QP:30.33  size:   105
[libx264 @ 0x2f82e00] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
[libx264 @ 0x2f82e00] mb I  I16..4:  0.5% 87.2% 12.3%
[libx264 @ 0x2f82e00] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  1.4%  0.0%  0.0%  0.0%  0.0%    skip:98.6%
[libx264 @ 0x2f82e00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0%  0.0%  direct: 0.0%  skip:99.9%  L0:25.6% L1:74.4% BI: 0.0%
[libx264 @ 0x2f82e00] 8x8 transform intra:87.2% inter:95.2%
[libx264 @ 0x2f82e00] coded y,uvDC,uvAC intra: 99.4% 99.1% 95.1% inter: 0.0% 0.3% 0.0%
[libx264 @ 0x2f82e00] i16 v,h,dc,p:  4%  2%  9% 84%
[libx264 @ 0x2f82e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 21% 10%  6%  8%  8%  9%  9% 14%
[libx264 @ 0x2f82e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 20%  8%  7% 10%  9% 11%  8% 11%
[libx264 @ 0x2f82e00] i8c dc,h,v,p: 39% 36% 10% 15%
[libx264 @ 0x2f82e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x2f82e00] ref P L0: 92.8%  0.0%  6.2%  1.0%
[libx264 @ 0x2f82e00] ref B L0: 96.3%  3.6%  0.1%
[libx264 @ 0x2f82e00] ref B L1: 99.3%  0.7%
[libx264 @ 0x2f82e00] kb/s:657.11
+ set +x

Apakah resolusinya hampir sama dengan PNG? Pencarian cepat mengungkapkan bahwa ini kemungkinan berkaitan dengan pengaturan memori (GPU) pada Pi, daripada output ffmpeg.
Gyan

Apakah Anda yakin pemutar Anda menangani yuvj420p? Coba tambahkan -pixfmt yuv420p.
Logo
Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.