Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Video ffmpeg仅使用ts中的音频生成文件_Video_Ffmpeg_Video Processing - Fatal编程技术网

Video ffmpeg仅使用ts中的音频生成文件

Video ffmpeg仅使用ts中的音频生成文件,video,ffmpeg,video-processing,Video,Ffmpeg,Video Processing,我正在尝试获取ts视频的某些部分,然后将它们合并到新视频中。问题是在进行分割时,视频会丢失。分割仅包含音频。以下是视频源信息: 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/

我正在尝试获取ts视频的某些部分,然后将它们合并到新视频中。问题是在进行分割时,视频会丢失。分割仅包含音频。以下是视频源信息:

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,我只能听到音频。视频已消失。

按顺序尝试以下三种方法

1. 2. 3. &然后

ffmpeg -ss 10 -i source.mp4 -t 5 -c copy cut1.ts

我怀疑在视频中搜索10秒并没有击中视频关键帧,因此最好只是重新编码,而不是尝试复制非关键帧。由于所有音频帧都分类为关键帧,因此可以复制音频

尝试:


您应该显示命令的控制台输出。@LordNeckbeard哪个命令?我在这里输入的输出来自命令的输出。顺便说一句,多亏了mulvya和VC的答案。我尝试了相同的转换,但将-t从5改为其他类似9的值,然后成功了。我想问题在于TSP的帧速率,这不是问题所在。从控制台查看此错误消息:
[mpegts@0x7fc9b9800000]找不到流0的编解码器参数(视频:h264([27][0][0][0]/0x001B),无):未指定大小。从输出的控制台中可以看到视频,但缺少属性。您是指h264编解码器的SPS和PPS吗?但是使用
编解码器拷贝
不会强制FFmpeg从10秒的时间戳直接拷贝。直接复制可能会使输出的第一帧包含一些非关键帧字节(因此没有SP或PPS),从而导致错误
找不到流的编解码器参数
…FFmpeg总是在复制模式下在GOP边界拆分。根据容器的不同,它要么改变输出时间戳,要么将负TS分配给不打算显示的帧。谢谢您的回答。此命令的结果与我使用的相同:仅包含音频的视频。谢谢您的回答。1) 使用慢速搜索,结果与作为示例的命令相同。2) 也具有与1)或我的示例相同的效果。3) 生成打开但结束非常快的视频。
-analyzeduration 200M-probesize 200M
帮助我:)
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
ffmpeg -ss 10 -i source_file.ts -t 5 -c:a copy -c:v libx264 cut1.ts