我试图获取视频的某些部分,然后将它们合并为一个新视频。问题是,在进行拆分时,视频会丢失。分割仅包含音频。以下是视频来源信息:
ffmpeg -i source_file.ts
ffmpeg version 3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.1 --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-libxvid --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mpegts, from '97274181.ts':
Duration: 00:02:30.70, start: 60.000000, bitrate: 3582 kb/s
Program 1
Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 139 kb/s
Stream #0:1[0x101]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, unknown/bt709/unknown), 1920x1080, 60 fps, 60 tbr, 90k tbn, 2k tbc
Stream #0:2[0x102]: Data: timed_id3 (ID3 / 0x20334449)
At least one output file must be specified
这是用于进行拆分的命令:
ffmpeg -ss 10 -i source_file.ts -t 5 -c copy cut1.ts
这是剪辑后的视频信息:
ffmpeg version 3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.1 --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-libxvid --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[NULL @ 0x7fc9ba008000] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 0x7fc9b9800000] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'siri1.ts':
Duration: 00:00:05.08, start: 1.400000, bitrate: 148 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 120 kb/s
At least one output file must be specified
如果我重现cut1.ts,我只能听到音频。视频消失了。
答案 0 :(得分:1)
按顺序尝试这三种方式
ffmpeg -i source_file.ts -ss 10 -t 5 -c copy cut1.ts
ffmpeg -analyzeduration 20M -probesize 20M -ss 10 -i source_file.ts -t 5 -c copy cut1.ts
ffmpeg -i source_file.ts -c copy -dn source.mp4
&安培;然后
ffmpeg -ss 10 -i source.mp4 -t 5 -c copy cut1.ts
答案 1 :(得分:0)
我怀疑在视频中寻找10秒没有观看视频关键帧,所以最好只是重新编码而不是尝试复制非关键帧。可以复制音频,因为所有音频帧都被归类为关键帧。
尝试:
ffmpeg -ss 10 -i source_file.ts -t 5 -c:a copy -c:v libx264 cut1.ts