FFMPEG将图像转换为视频只显示黑屏

FFMPEG将图像转换为视频只显示黑屏

https://superuser.com/questions/996243/ffmpeg-convert-image-to-video-displays-only-black 原始问题,我以访客身份发布了该问题,但无法编辑。因此我创建了一个新的

我使用 ffmpeg4android 在我的 android 应用中使用 ffmpeg 命令。我使用此命令将单个图像文件转换为 30 秒长的视频:

ffmpeg -y -r 1/30 -i /storage/emulated/0/DCIM/image.jpeg -strict experimental -pix_fmt yuv420p /data/data/com.example/files/output.avi

然而,输出的是一个30秒长的视频,只显示黑屏。

命令有问题吗?我尝试寻找答案,但大多数人都说添加 -pix_fmt yuv420p,但这不会改变任何东西

编辑:这是日志

ffmpeg version N-69972-g6c91afe Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.4.3 (GCC)
ffmpeg4android 2.5_23 
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 25.100 / 56. 25.100
  libavformat    56. 23.100 / 56. 23.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.100 /  5. 11.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '1/30'.
Reading option '-i' ... matched as input file with argument '/storage/emulated/0/DCIM/image.jpeg'.
Reading option '-strict' ...Routing option strict to both codec and muxer layer
 matched as AVOption 'strict' with argument 'experimental'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '/data/data/com.example/files/output.avi.avi' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /storage/emulated/0/DCIM/image.jpeg.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 1/30.
Successfully parsed a group of options.
Opening an input file: /storage/emulated/0/DCIM/image.jpeg.
Format image2 probed with size=2048 and score=50
Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
Statistics: 78662 bytes read, 0 seeks
marker=d8 avail_size_in_buf=78660
marker parser used 0 bytes (0 bits)
marker=e0 avail_size_in_buf=78658
marker parser used 16 bytes (128 bits)
marker=e2 avail_size_in_buf=78640
marker parser used 539 bytes (4312 bits)
marker=db avail_size_in_buf=78098
index=0
qscale[0]: 4
marker parser used 67 bytes (536 bits)
marker=db avail_size_in_buf=78029
index=1
qscale[1]: 7
marker parser used 67 bytes (536 bits)
marker=c2 avail_size_in_buf=77960
sof0: picture: 960x645
component 0 2:2 id: -1 quant:0
component 1 1:1 id: 0 quant:1
component 2 1:1 id: 1 quant:1
pix fmt id 22111100
marker parser used 17 bytes (136 bits)
marker=c4 avail_size_in_buf=77941
class=0 index=0 nb_codes=8
marker parser used 27 bytes (216 bits)
marker=c4 avail_size_in_buf=77912
class=0 index=1 nb_codes=6
marker parser used 25 bytes (200 bits)
marker=c4 avail_size_in_buf=77885
class=0 index=1 nb_codes=6
marker parser used 25 bytes (200 bits)
escaping removed 70674 bytes
marker=da avail_size_in_buf=77858
component: -1
component: 0
component: 1
marker parser used 7183 bytes (57461 bits)
marker=c4 avail_size_in_buf=70666
class=1 index=0 nb_codes=97
marker parser used 49 bytes (392 bits)
escaping removed 62231 bytes
marker=da avail_size_in_buf=70615
component: -1
marker parser used 8383 bytes (67059 bits)
marker=c4 avail_size_in_buf=62215
class=1 index=1 nb_codes=146
marker parser used 43 bytes (344 bits)
escaping removed 61457 bytes
marker=da avail_size_in_buf=62170
component: 1
marker parser used 712 bytes (5692 bits)
marker=c4 avail_size_in_buf=61454
class=1 index=1 nb_codes=129
marker parser used 41 bytes (328 bits)
escaping removed 60607 bytes
marker=da avail_size_in_buf=61411
component: 0
marker parser used 803 bytes (6418 bits)
marker=c4 avail_size_in_buf=60603
class=1 index=0 nb_codes=242
marker parser used 62 bytes (496 bits)
escaping removed 54202 bytes
marker=da avail_size_in_buf=60539
component: -1
marker parser used 6336 bytes (50684 bits)
marker=c4 avail_size_in_buf=54184
class=1 index=0 nb_codes=242
marker parser used 43 bytes (344 bits)
escaping removed 40886 bytes
marker=da avail_size_in_buf=54139
component: -1
marker parser used 13252 bytes (106011 bits)
escaping removed 39000 bytes
marker=da avail_size_in_buf=40858
component: -1
component: 0
component: 1
marker parser used 1857 bytes (14856 bits)
marker=c4 avail_size_in_buf=38992
class=1 index=1 nb_codes=241
marker parser used 39 bytes (312 bits)
escaping removed 37662 bytes
marker=da avail_size_in_buf=38951
component: 1
marker parser used 1288 bytes (10301 bits)
marker=c4 avail_size_in_buf=37659
class=1 index=1 nb_codes=178
marker parser used 36 bytes (288 bits)
escaping removed 36349 bytes
marker=da avail_size_in_buf=37621
component: 0
marker parser used 1271 bytes (10161 bits)
marker=c4 avail_size_in_buf=36343
class=1 index=0 nb_codes=242
marker parser used 43 bytes (344 bits)
escaping removed 161 bytes
marker=da avail_size_in_buf=36298
component: -1
marker parser used 36136 bytes (289085 bits)
marker=d9 avail_size_in_buf=0
decode frame unused 0 bytes
After avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 frames:1
Input #0, image2, from '/storage/emulated/0/DCIM/image.jpeg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 15732 kb/s
    Stream #0:0, 1, 1/25: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 960x645 [SAR 1:1 DAR 64:43], 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output file /data/data/com.example/files/output.avi.avi.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Successfully parsed a group of options.
Opening an output file: /data/data/com.example/files/output.avi.avi.
Successfully opened the file.
detected 4 logical cores
Setting 'video_size' to value '960x645'
Setting 'pix_fmt' to value '12'
Setting 'time_base' to value '30/1'
Setting 'pixel_aspect' to value '1/1'
Setting 'sws_param' to value 'flags=2'
Setting 'frame_rate' to value '1/30'
w:960 h:645 pixfmt:yuvj420p tb:30/1 fr:1/30 sar:1/1 sws_param:flags=2
Setting 'expr' to value 'N'
compat: called with args=[yuv420p]
Setting 'pix_fmts' to value 'yuv420p'
Setting 'flags' to value '0x4'
w:iw h:ih flags:'0x4' interl:0
auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
query_formats: 5 queried, 3 merged, 1 already done, 0 delayed
TB:30.000000 FRAME_RATE:0.033333 SAMPLE_RATE:nan
deprecated pixel format used, make sure you did set range correctly
w:960 h:645 fmt:yuvj420p sar:1/1 -> w:960 h:645 fmt:yuv420p sar:1/1 flags:0x4
bitrate tolerance 4000000 too small for bitrate 200000, overriding
intra_quant_bias = 0 inter_quant_bias = -64
Output #0, avi, to '/data/data/com.example/files/output.avi.avi':
  Metadata:
    ISFT            : Lavf56.23.100
    Stream #0:0, 0, 30/1: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 960x645 [SAR 1:1 DAR 64:43], q=2-31, 200 kb/s, 0.03 fps, 0.03 tbn, 0.03 tbc
    Metadata:
      encoder         : Lavc56.25.100 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
marker=d8 avail_size_in_buf=78660
marker parser used 0 bytes (0 bits)
marker=e0 avail_size_in_buf=78658
marker parser used 16 bytes (128 bits)
marker=e2 avail_size_in_buf=78640
marker parser used 539 bytes (4312 bits)
marker=db avail_size_in_buf=78098
index=0
qscale[0]: 4
marker parser used 67 bytes (536 bits)
marker=db avail_size_in_buf=78029
index=1
qscale[1]: 7
marker parser used 67 bytes (536 bits)
marker=c2 avail_size_in_buf=77960
sof0: picture: 960x645
component 0 2:2 id: -1 quant:0
component 1 1:1 id: 0 quant:1
component 2 1:1 id: 1 quant:1
pix fmt id 22111100
marker parser used 17 bytes (136 bits)
marker=c4 avail_size_in_buf=77941
class=0 index=0 nb_codes=8
marker parser used 27 bytes (216 bits)
marker=c4 avail_size_in_buf=77912
class=0 index=1 nb_codes=6
marker parser used 25 bytes (200 bits)
marker=c4 avail_size_in_buf=77885
class=0 index=1 nb_codes=6
marker parser used 25 bytes (200 bits)
escaping removed 70674 bytes
marker=da avail_size_in_buf=77858
component: -1
component: 0
component: 1
marker parser used 7183 bytes (57461 bits)
marker=c4 avail_size_in_buf=70666
class=1 index=0 nb_codes=97
marker parser used 49 bytes (392 bits)
escaping removed 62231 bytes
marker=da avail_size_in_buf=70615
component: -1
marker parser used 8383 bytes (67059 bits)
marker=c4 avail_size_in_buf=62215
class=1 index=1 nb_codes=146
marker parser used 43 bytes (344 bits)
escaping removed 61457 bytes
marker=da avail_size_in_buf=62170
component: 1
marker parser used 712 bytes (5692 bits)
marker=c4 avail_size_in_buf=61454
class=1 index=1 nb_codes=129
marker parser used 41 bytes (328 bits)
escaping removed 60607 bytes
marker=da avail_size_in_buf=61411
component: 0
marker parser used 803 bytes (6418 bits)
marker=c4 avail_size_in_buf=60603
class=1 index=0 nb_codes=242
marker parser used 62 bytes (496 bits)
escaping removed 54202 bytes
marker=da avail_size_in_buf=60539
component: -1
marker parser used 6336 bytes (50684 bits)
marker=c4 avail_size_in_buf=54184
class=1 index=0 nb_codes=242
marker parser used 43 bytes (344 bits)
escaping removed 40886 bytes
marker=da avail_size_in_buf=54139
component: -1
marker parser used 13252 bytes (106011 bits)
escaping removed 39000 bytes
marker=da avail_size_in_buf=40858
component: -1
component: 0
component: 1
marker parser used 1857 bytes (14856 bits)
marker=c4 avail_size_in_buf=38992
class=1 index=1 nb_codes=241
marker parser used 39 bytes (312 bits)
escaping removed 37662 bytes
marker=da avail_size_in_buf=38951
component: 1
marker parser used 1288 bytes (10301 bits)
marker=c4 avail_size_in_buf=37659
class=1 index=1 nb_codes=178
marker parser used 36 bytes (288 bits)
escaping removed 36349 bytes
marker=da avail_size_in_buf=37621
component: 0
marker parser used 1271 bytes (10161 bits)
marker=c4 avail_size_in_buf=36343
class=1 index=0 nb_codes=242
marker parser used 43 bytes (344 bits)
escaping removed 161 bytes
marker=da avail_size_in_buf=36298
component: -1
marker parser used 36136 bytes (289085 bits)
marker=d9 avail_size_in_buf=0
decode frame unused 0 bytes
Cliping frame in rate conversion by 0.000008
EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
frame=    1 fps=0.0 q=7.8 Lsize=      53kB time=00:00:30.00 bitrate=  14.6kbits/s    
video:48kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 11.839626%
Input file #0 (/storage/emulated/0/DCIM/image.jpeg):
  Input stream #0:0 (video): 1 packets read (78662 bytes); 1 frames decoded; 
  Total: 1 packets (78662 bytes) demuxed
Output file #0 (/data/data/com.example/files/output.avi.avi):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (48836 bytes); 
  Total: 1 packets (48836 bytes) muxed
1 frames successfully decoded, 0 decoding errors
ffmpeg4android: 0

相关内容