ffmpeg 在从 Linux 管道读取图像路径时表示"No JPEG data found in image"



我正在尝试将一组图片转换为视频,我想从管道中读取图片的文件路径。我想运行的命令如下所示:

find dir/*.JPG | sort | ffmpeg -f image2pipe -r 1 -vcodec mjpeg -s 6000x4000 -pix_fmt yuvj422p -i - -vcodec libx264 -s 1080x720 -r 20 -pix_fmt yuv420p out.mkv

但是我一直得到No JPEG data found in image错误。以下是完整的日志:

Input #0, image2pipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj422p(bt470bg/unknown/unknown), 6000x4000, 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
[mjpeg @ 0x558e98cd7300] No JPEG data found in image
Error while decoding stream #0:0: Invalid data found when processing input
[swscaler @ 0x558e98ce9440] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x558e98cdaac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x558e98cdaac0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x558e98cdaac0] 264 - core 161 r3039 544c61f - H.264/MPEG-4 AVC codec - Copyleft
2003-2021 - 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=20 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, matroska, to 'out.mkv':
Metadata:
encoder         : Lavf58.76.100
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1080x720, q=2-31, 20 fps, 1k tbn
Metadata:
encoder         : Lavc58.134.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    0 fps=0.0 q=0.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

图片格式如下(mediainfo),文件名格式为DSC_1234.JPG:

Format                                   : JPEG
Video
Format                                   : JPEG
Width                                    : 6 000 pixels
Height                                   : 4 000 pixels
Display aspect ratio                     : 3:2
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Compression mode                         : Lossy

另外,我想避免使用没有管道路径的解决方案(例如-f image2 -i DSC_%04d.JPG)。你知道发生了什么吗?

您的命令正在向管道传递文件的名称,但需要文件的内容,请像这样调整您的命令:

find dir/ -iname '*.jpg' | xargs cat | ffmpeg -f image2pipe -r 1 -vcodec mjpeg -s 6000x4000 -pix_fmt yuvj422p -i - -vcodec libx264 -s 1080x720 -r 20 -pix_fmt yuv420p out.mkv

最新更新