【问题标题】:FFmpeg convert single image into video AndroidFFmpeg 将单个图像转换为视频 Android
【发布时间】:2014-05-02 09:17:11
【问题描述】:

我正在尝试使用 FFmpeg 将单个图像转换为视频。我已尝试关注文件:

"ffmpeg  -analyzeduration 2147483647 -probesize 2147483647 -i " + packat.get(i).path +"-r 25 -t 1000 -y op.mp4"

"ffmpeg -loop 1 -r 23.976 -i input.jpg -t 00:00:02 -vcodec qtrle -an output.mov"

"ffmpeg -i c:\rawvideo\mask.bmp -loop 1 -r 29.97 -s 720x480
        -aspect 4:3 -t 00:04:05 -vcodec mjpeg -vb 11261600 -an
        c:\rawvideo\fullmask.avi"

但是他们都给我这个烦人的错误:

 Can not process SOS before SOF, skipping marker parser used 0 bytes (0 bits) decode frame unused 0 bytes decoding for stream 0 failed 
Could not find codec parameters for stream 0 (Video: mjpeg): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options /storage/sdcard0/cblVE/temp/0.jpg: could not find codec parameters 
exit_program: 1 

请帮忙。我已经搜索了一周的解决方案,但我一无所获。

【问题讨论】:

  • 添加标志(视频选项和音频选项标志),即更改 vcodec 选项 mpeg4 和额外标志需要 -r 检查此链接:(trac.ffmpeg.org/wiki/…
  • 不工作,同样的错误
  • 有时我会给出答案.ok...
  • 好的,我会等它
  • ffmpeg -y -i /sdcard/img.png -loop 1 -vcodec libx264 -s 320*480 -b 1024k -t 2 -an /sdcard/test.mp4

标签: android ffmpeg


【解决方案1】:

--编辑--

  1. 您使用“-f mp4”所以,在您的 ffmpeg config/buid 中,您是否要求这样做? 使用“ffmpeg -formats”进行验证并检查您的构建是否真正支持 mp4。

  2. 查看您的日志并转到 source code 获取“libavcodec/mux.c”

    在源 func=avformat_alloc_output_context2 中搜索第 124 行

    根据您的 pastebin #210,这是您的日志错误的来源

    根据方法的第 146 行和您的 pastebin - 您没有值 对于'文件名' ....

    在您的 pastebin #209-210 中,对于您的输出来说,这是一个非常奇怪的文件名?

    尤其是因为您的 CLI args 例程显示输出文件名已被 ffmpeg.c 接受。

以下是在 linux 上运行的,但可以在 android 上运行,具体取决于您的 ffmpeg android 版本...

ffmpeg -y -loop 1 -t 3.03 -i ~/Pictures/yaya_speech_choose2.png   -r 1  -vcodec libx264 -b:v 200k -bt 350k   -f mp4 ~/Videos/dummy.mp4


ffmpeg version N-35901-g27a3415 Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct  7 2012 12:06:43 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      51. 73.102 / 51. 73.102
  libavcodec     54. 64.100 / 54. 64.100
  libavformat    54. 29.105 / 54. 29.105
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 19.102 /  3. 19.102
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, image2, from '/home/rob/Pictures/yaya_speech_choose2.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgb24, 1080x1920, 25 fps, 25 tbr, 25 tbn, 25 tbc
-t is not an input option, keeping it for the next output; consider fixing your command line.
[libx264 @ 0x1e32500] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x1e32500] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
[libx264 @ 0x1e32500] 264 - core 128 r10 198a7ea - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=4 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=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/home/rob/Videos/dummy.mp4':
  Metadata:
    encoder         : Lavf54.29.105
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv444p, 1080x1920, q=-1--1, 200 kb/s, 16384 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame=    4 fps=1.8 q=32766.0 Lsize=     236kB time=00:00:02.00 bitrate= 968.3kbits/s dup=0 drop=59    
video:236kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.350287%
[libx264 @ 0x1e32500] frame I:1     Avg QP: 9.29  size:239979
[libx264 @ 0x1e32500] frame P:1     Avg QP: 9.85  size:   128
[libx264 @ 0x1e32500] frame B:2     Avg QP: 9.92  size:   192
[libx264 @ 0x1e32500] consecutive B-frames: 25.0%  0.0% 75.0%  0.0%
[libx264 @ 0x1e32500] mb I  I16..4: 36.2% 49.0% 14.7%
[libx264 @ 0x1e32500] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:99.8%
[libx264 @ 0x1e32500] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.1%  0.1%  direct: 0.3%  skip:99.2%  L0:68.9% L1:31.1% BI: 0.0%
[libx264 @ 0x1e32500] final ratefactor: 24.49
[libx264 @ 0x1e32500] 8x8 transform intra:49.0% inter:92.3%
[libx264 @ 0x1e32500] coded y,u,v intra: 37.6% 27.9% 30.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x1e32500] i16 v,h,dc,p: 84% 10%  3%  3%
[libx264 @ 0x1e32500] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 67%  5%  2%  3%  2%  4%  4%  3%
[libx264 @ 0x1e32500] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 44% 10%  4%  6%  3%  8%  3%  6%
[libx264 @ 0x1e32500] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x1e32500] kb/s:480.98

【讨论】:

  • 查看日志。您的应用在该路径上是否具有写入权限? '/storage/sdcard0/cblVE/temp/a0.mp4' .
  • 在我的回答中查看 --EDIT
  • 顺便说一句...基于该错误,我会非常怀疑您为 android 构建的 ffmpeg。您的 pastebin 显示它接受输出文件的 CLI 参数...然而,在 mux.c 类中,它的文件名为 null 输出文件。就好像你的 CLI 参数在 ffmpeg.c 和 mux.c 之间的某个地方丢失了。如果这是真的,那么您正在使用错误的链接或错误的构建。
  • 它支持 mp4,因为我可以使用此版本剪切 mp4 视频。关于错误的输出名称,“a0.mp4”是 mp4 的错误名称吗?请参阅我在上面的问题中发布了 3 个命令。我能够从一些图像创建视频,但它在一些图像上崩溃了​​。所以,我认为名字不是问题。你说什么?
  • 使用“-y”查看out文件的问题是否受到影响
【解决方案2】:

也许你必须编译一个新的 ffmpeg 构建并使用它。你能告诉我你用的是哪个videokit吗?

【讨论】:

【解决方案3】:

你的 ffmpeg 版本一定有问题。请建立一个新的。

【讨论】:

    猜你喜欢
    • 2017-02-26
    • 1970-01-01
    • 2014-03-02
    • 1970-01-01
    • 1970-01-01
    • 2020-10-08
    • 2017-11-10
    • 2020-03-20
    • 1970-01-01
    相关资源
    最近更新 更多