我需要在命令行中重新缩放jpg图像。我使用ffmpeg:
ffmpeg -loglevel debug -i photo.jpg -vf scale=1920:1080 photo_scaled.jpg
它完全适用于我的Mac工作并提供以下输出:
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input file with argument 'photo.jpg'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=1920:1080'.
Reading option 'photo_scaled.jpg' ... matched as output file. Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options.
Parsing a group of options: input file photo.jpg. Successfully parsed a group of options.
Opening an input file: photo.jpg.
[png_pipe @ 0x7fd221810600] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0x7fd221810600] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
[png_pipe @ 0x7fd221810600] After avformat_find_stream_info() pos: 303755 bytes read:303755 seeks:0 frames:1 Input #0, png_pipe, from 'photo.jpg':
Duration: N/A, bitrate: N/A
Stream #0:0, 1, 1/25: Video: png, 1 reference frame, rgb24(pc), 905x509 (0x0), 1/25, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output file photo_scaled.jpg.
Applying option vf (set video filters) with argument scale=1920:1080. Successfully parsed a group of options.
Opening an output file: photo_scaled.jpg
但是在amazone服务器上,它给了我以下内容:
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input file with argument 'photo.jpg'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=1920:1080'.
Reading option 'photo_scaled.jpg' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file photo.jpg.
Successfully parsed a group of options.
Opening an input file: photo.jpg.
[AVIOContext @ 0x372f700] Statistics: 303755 bytes read, 0 seeks
[mjpeg @ 0x372c6a0] marker=f9 avail_size_in_buf=303444
[mjpeg @ 0x372c6a0] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x372c6a0] marker=de avail_size_in_buf=303438
[mjpeg @ 0x372c6a0] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x372c6a0] marker=fd avail_size_in_buf=302501
[mjpeg @ 0x372c6a0] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x372c6a0] marker=f3 avail_size_in_buf=298342
[mjpeg @ 0x372c6a0] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x372c6a0] marker=f8 avail_size_in_buf=297965
[mjpeg @ 0x372c6a0] invalid id 248
[image2 @ 0x372b880] decoding for stream 0 failed
[image2 @ 0x372b880] Could not find codec parameters for stream 0 (Video: mjpeg): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
photo.jpg: could not find codec parameters
在我查看时,ffmpeg的配置不同。 在linux上:
ffmpeg version N-63893-gc69defd
built on Jul 16 2014 05:38:01 with gcc 4.6 (Debian 4.6.3-1)
configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
libavutil 52. 89.100 / 52. 89.100
libavcodec 55. 66.101 / 55. 66.101
libavformat 55. 43.100 / 55. 43.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 8.100 / 4. 8.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
在Mac上:
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.0.2 (clang-700.1.81)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
但是区别于图像缩放的具体内容是什么?如何让amazone linux的ffmpeg版本与Mac的版本相同(至少在这种情况下)?