だから、これは私がビデオをチェックしたときに1時間以上のタイムスタンプで今日ビデオのアップロードを受け取ったのは興味深いです。その長さはわずか8分です。
"C:/server/ffmpeg/bin/ffmpeg.exe" -i Z:/server/websites/ps/public_www/media/com_hwdmediashare/files/bd/47/a0/4a66f518323b18db8ff0ec3652c01914.mov 2>&1
ffmpeg version N-68639-g6706a29 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 20 2014 22:12:53 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 16.100 / 56. 16.100
libavformat 56. 16.101 / 56. 16.101
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 4.100 / 5. 4.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[wmv3 @ 0000000004479360] Extra data: 8 bits left, value: 0
[asf @ 0000000004490c40] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, asf, from 'Z:/server/websites/ps/public_www/media/com_hwdmediashare/files/bd/47/a0/4a66f518323b18db8ff0ec3652c01914.mov':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: L1
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
Duration: 01:17:42.07, start: 0.000000, bitrate: 1096 kb/s
Stream #0:0(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 640x480, 1000 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 96 kb/s
At least one output file must be specified
そして、これがサムネイル生成の入力と出力です。
"C:/server/ffmpeg/bin/ffmpeg.exe" -y -itsoffset -2331 -i Z:/server/websites/ps/public_www/media/com_hwdmediashare/files/bd/47/a0/4a66f518323b18db8ff0ec3652c01914.mov -vcodec mjpeg -vframes 1 -an -f rawvideo -s 134x100 Z:/server/websites/ps/public_www/media/com_hwdmediashare/files/bd/47/a0/32274bd09e981494f07357325dacdd7b.jpg 2>&1
ffmpeg version N-68639-g6706a29 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 20 2014 22:12:53 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 16.100 / 56. 16.100
libavformat 56. 16.101 / 56. 16.101
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 4.100 / 5. 4.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[wmv3 @ 000000000443c040] Extra data: 8 bits left, value: 0
[asf @ 0000000004439be0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, asf, from 'Z:/server/websites/ps/public_www/media/com_hwdmediashare/files/bd/47/a0/4a66f518323b18db8ff0ec3652c01914.mov':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: L1
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
Duration: 01:17:42.07, start: 0.000000, bitrate: 1096 kb/s
Stream #0:0(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 640x480, 1000 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 96 kb/s
[swscaler @ 00000000044300a0] deprecated pixel format used, make sure you did set range correctly
[wmv3 @ 00000000044c3f60] Extra data: 8 bits left, value: 0
Output #0, rawvideo, to 'Z:/server/websites/ps/public_www/media/com_hwdmediashare/files/bd/47/a0/32274bd09e981494f07357325dacdd7b.jpg':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: L1
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
encoder : Lavf56.16.101
Stream #0:0(eng): Video: mjpeg, yuvj420p(pc), 134x100, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.16.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (wmv3 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=230
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=482
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=725
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=968
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=1216
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=1466
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=1714
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=1948
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=2206
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=2451
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=2694
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=2933
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=3168
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=3412
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=3657
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=3911
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=4158
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=4389
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=4625
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=4884
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=5141
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=5394
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=5645
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=5898
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=6170
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=0 drop=6434
frame= 0 fps=0.0 q=0.0
タイムスタンプが不正確なビデオを修正して、生成されたサムネイルが破損しないようにする方法はありますか?
PHPで期間を取得する方法
preg_match('/Duration: (.*?),/', implode("\n",$output), $matches);
$duration_string = $matches[1];
list($hr,$m,$s) = explode(':', $duration_string);
$duration = ( (int)$hr*3600 ) + ( (int)$m*60 ) + (int)$s;
$duration = (int) $duration;
通常、これを修正するには、再エンコードせずにビデオの新しいコピーを作成します。
ffmpeg -i input -c:v copy -c:a copy output
次に、新しいビデオからサムネイルを生成してみてください。