在将视频从 mp4 转换为 flv 时,我遇到了奇怪的持续时间问题。此外,还有一个不同的“start_time”,那是什么?start_time 是什么意思?
input duration - 0:00:29.577000
input start_time - 0:00:00.000000
output duration - 0:00:51.518000
output start_time - 0:00:21.840000
ffmpeg 命令:
ffmpeg -y -i 18579-1386758783533.mp4 -c:a libfdk_aac -b:a 128k -ar 22050 -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -framerate 30 v18579-1386758783533.flv
FFprobe-输入文件:
dead@dead-work-desktop:~/36369/wowzaoutput$ ffprobe 18579-1386758783533.mp4
ffprobe version git-2013-11-29-0d640c0 Copyright (c) 2007-2013 the FFmpeg developers
built on Nov 29 2013 11:54:34 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x39cb280] decoding for stream 0 failed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '18579-1386758783533.mp4':
Metadata:
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
creation_time : 2013-12-11 10:46:22
Duration: 00:00:29.58, start: 0.000000, bitrate: 134 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 121 kb/s, 6.53 fps, 30 tbr, 90k tbn, 60 tbc (default)
Metadata:
creation_time : 2013-12-11 10:46:22
handler_name : WowzaMediaServerPro
Stream #0:1(eng): Audio: speex (spex / 0x78657073), 16000 Hz, mono, s16, 11 kb/s (default)
Metadata:
creation_time : 2013-12-11 10:46:22
handler_name : WowzaMediaServerPro
FFprobe-输出文件:
dead@dead-work-desktop:~/36369/wowzaoutput$ ffprobe v18579-1386758783533.flv
ffprobe version git-2013-11-29-0d640c0 Copyright (c) 2007-2013 the FFmpeg developers
built on Nov 29 2013 11:54:34 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, flv, from 'v18579-1386758783533.flv':
Metadata:
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
encoder : Lavf55.21.100
Duration: 00:00:51.52, start: 21.840000, bitrate: 366 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 30.33 tbr, 1k tbn, 60 tbc
Stream #0:1: Audio: aac, 22050 Hz, mono, fltp, 128 kb/s
完整的 ffmpeg 命令行输出:
dead@dead-work-desktop:~/36369/wowzaoutput$ ffmpeg -y -i 18579-1386758783533.mp4 -c:a libfdk_aac -b:a 128k -ar 22050 -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -framerate 30 1v18579-1386758783533.flv
ffmpeg version git-2013-11-29-0d640c0 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 29 2013 11:54:34 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x29f3b00] decoding for stream 0 failed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '18579-1386758783533.mp4':
Metadata:
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
creation_time : 2013-12-11 10:46:22
Duration: 00:00:29.58, start: 0.000000, bitrate: 134 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 121 kb/s, 6.53 fps, 30 tbr, 90k tbn, 60 tbc (default)
Metadata:
creation_time : 2013-12-11 10:46:22
handler_name : WowzaMediaServerPro
Stream #0:1(eng): Audio: speex (spex / 0x78657073), 16000 Hz, mono, s16, 11 kb/s (default)
Metadata:
creation_time : 2013-12-11 10:46:22
handler_name : WowzaMediaServerPro
[libx264 @ 0x29f8f60] using SAR=1/1
[libx264 @ 0x29f8f60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x29f8f60] profile High, level 4.0
[libx264 @ 0x29f8f60] 264 - core 140 r2 1ca7bb9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=25 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, flv, to '1v18579-1386758783533.flv':
Metadata:
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
encoder : Lavf55.21.102
Stream #0:0(eng): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 30 tbc (default)
Metadata:
creation_time : 2013-12-11 10:46:22
handler_name : WowzaMediaServerPro
Stream #0:1(eng): Audio: aac (libfdk_aac) ([10][0][0][0] / 0x000A), 22050 Hz, mono, s16, 128 kb/s (default)
Metadata:
creation_time : 2013-12-11 10:46:22
handler_name : WowzaMediaServerPro
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (libspeex -> libfdk_aac)
Press [q] to stop, [?] for help
frame= 193 fps= 16 q=-1.0 Lsize= 2300kB time=00:00:29.60 bitrate= 636.4kbits/s
video:1821kB audio:464kB subtitle:0 global headers:0kB muxing overhead 0.648628%
[libx264 @ 0x29f8f60] frame I:3 Avg QP:15.65 size: 31001
[libx264 @ 0x29f8f60] frame P:110 Avg QP:22.60 size: 12905
[libx264 @ 0x29f8f60] frame B:80 Avg QP:25.85 size: 4399
[libx264 @ 0x29f8f60] consecutive B-frames: 24.9% 56.0% 10.9% 8.3%
[libx264 @ 0x29f8f60] mb I I16..4: 17.6% 76.5% 5.9%
[libx264 @ 0x29f8f60] mb P I16..4: 6.9% 17.2% 0.2% P16..4: 22.4% 3.4% 1.2% 0.0% 0.0% skip:48.7%
[libx264 @ 0x29f8f60] mb B I16..4: 0.4% 0.5% 0.0% B16..8: 22.2% 1.0% 0.1% direct: 1.4% skip:74.3% L0:45.4% L1:52.8% BI: 1.8%
[libx264 @ 0x29f8f60] 8x8 transform intra:71.0% inter:91.3%
[libx264 @ 0x29f8f60] coded y,uvDC,uvAC intra: 16.3% 19.8% 0.9% inter: 4.7% 7.2% 0.0%
[libx264 @ 0x29f8f60] i16 v,h,dc,p: 23% 17% 5% 54%
[libx264 @ 0x29f8f60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 51% 14% 22% 2% 2% 2% 2% 3% 1%
[libx264 @ 0x29f8f60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 48% 18% 12% 3% 7% 4% 3% 3% 1%
[libx264 @ 0x29f8f60] i8c dc,h,v,p: 69% 13% 17% 2%
[libx264 @ 0x29f8f60] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x29f8f60] ref P L0: 75.4% 4.7% 14.1% 5.8%
[libx264 @ 0x29f8f60] ref B L0: 88.6% 10.9% 0.5%
[libx264 @ 0x29f8f60] ref B L1: 98.2% 1.8%
[libx264 @ 0x29f8f60] kb/s:504.48
输入文件关联
答案1
我下载了您的 .mp4 视频样本,除非我将文件类型更改为,否则播放效果非常糟糕.f4v
。视频在播放声音时会保持冻结状态一段时间,然后在大约 21 秒后,视频开始移动并与声音同步。
在我看来,您得到的糟糕转换只反映了您的视频的真实状态。
output duration - output start_time
我注意到转换前后的差异是相同的,因此看起来 ffmpeg 只是在转换中反映了该视频开始时发现的现有呈现问题。
我建议你找到另一种从网络摄像头录制的方法,因为显然你当前的方法和软件会生成无效的视频文件。我还发现奇怪的是 .mp4 文件是使用 f4v 的 Flash 编解码器编码的。