FFmpeg的 - 从传输流文件中提取视频和音频(.TS) [英] FFmpeg - Extracting video and audio from transport stream file (.ts)

查看:4101
本文介绍了FFmpeg的 - 从传输流文件中提取视频和音频(.TS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要的提取某个节目的音频和视频传输流文件(.TS)通过指定PID不生成的文件中丢失的质量和使用相同的codeC (输出文件是MPEG)。

是,即使的可能的与FFmpeg的?如果是这样,我该怎么办呢?

到目前为止,我已经来到这个命令:

 的ffmpeg -i tsfile.ts -v codeC副本-a codeC副本-q:V 1 output.mpg

修改的:请注意,文件output.mpg被创建。该文件包含视频但音频不附加(无声音)。此外,我不能指定程序的PID来提取。

编辑2 的:这里的的ffmpeg的输出-i tsfile.ts

 的ffmpeg版本N-47062-g26c531c版权所有(C)2000-2012 FFmpeg的开发者
建于2012年11月25日12时21分26秒用gcc 4.7.2(GCC)
    libavutil 52 9.100 / 9.100 52
    libav codeC 54 77.100 / 54 77.100
    54. libavformat流37.100 / 54 37.100
    libavdevice 54 3.100 / 3.100 54
    libavfilter 3. 23.102 / 3 23.102
    libswscale 2. 1.102 / 2 1.102
    libswresample 0. 17.101 / 0 17.101
    libpostproc 52 2.100 / 2.100 52
[mpeg2video @ 0201c7a0] mpeg_de code_postinit()失败
最后一条消息重复10次
[MPEGTS @ 0037b800] PES包大小不匹配
输入#0,MPEGTS,从'tsfile.ts:
时间:00:01:30.58,启动:56297.848344,比特率:18045 KB /秒
计划1
    流#0:0 [0X31]:视频:mpeg2video(主)([2] [0] [0] [0] / 0×0002),YUV420P,1920×1080 [SAR 1:1 DAR 16:9],29.97,29.97 TBR,90K TBN,59.94 TBC
    流#0:1 [0x34]:音频:AC3([129] [0] [0] [0] / 0x0081),48000赫兹,5.1(侧),S16,384 kb / s的

下面是对一个.TS tsinfo.exe文件

从C

 阅读:\\ tsfile.ts
扫描10000 TS包数据包1 PAT
节目列表:
    计划1 - > PID 0020(32)包2是PMT具有PID 0020(32)
  程序1,第1版,PCR PID 0031(49)
     节目信息(38字节):0E 03 C0 B9 16 10 06 02 C0 C0 71 04 00 0B 02 42 05 3F 04
                              47 41 39 34 86 0D E2 65 6E 67 7E 3F FF 65 6E 67 C1 3F FF
 最大比特率(3字节):C0 B9 16
 平滑缓冲器(6字节):C0 02 71 C0 04 00
 系统时钟(2字节):42 3F
 注册GA94
 描述标签86(134)(13字节):E2 65 6E 67 7E 3F FF 65 6E 67 C1 3F FF
  节目流:
PID 0031(49) - >码流类型02(2)H.262 / 13818-2视频(MPEG-2)或11172-2约束的视频
PID 0034(52) - >码流类型81(129)用户的私人
    ES信息(6字节):6A 04 41 43 2D 33
    DVB的AC-3(4字节):41 43 2D 33找到14 PAT包和7 PMT包在10000 TS包


解决方案

ffmpeg的可以选择的节目流以及节目中的基本流。
使用地图选项并流说明。
看着 -
<一href=\"http://superuser.com/questions/343716/ffmpeg-how-to-demux-live-multi-program-transport-stream\">http://superuser.com/questions/343716/ffmpeg-how-to-demux-live-multi-program-transport-stream

I wish to extract the audio and video of a certain program in a transport stream file (.ts) by specifying its PID without losing quality and using the same codec in the resulting file (the output file is a MPEG).

Is that even possible with FFmpeg? If so, how can I do it?

So far, I've come to this command:

 ffmpeg -i tsfile.ts -vcodec copy -acodec copy -q:v 1 output.mpg

Edit: Note that the file output.mpg is created. The file contains the video but the audio isn't attached (no sound). Also, I am unable to specify the program PID to extract.

Edit 2: Here's the output of ffmpeg -i tsfile.ts

ffmpeg version N-47062-g26c531c Copyright (c) 2000-2012 the FFmpeg developers
built on Nov 25 2012 12:21:26 with gcc 4.7.2 (GCC)
    libavutil      52.  9.100 / 52.  9.100
    libavcodec     54. 77.100 / 54. 77.100
    libavformat    54. 37.100 / 54. 37.100
    libavdevice    54.  3.100 / 54.  3.100
    libavfilter     3. 23.102 /  3. 23.102
    libswscale      2.  1.102 /  2.  1.102
    libswresample   0. 17.101 /  0. 17.101
    libpostproc    52.  2.100 / 52.  2.100
[mpeg2video @ 0201c7a0] mpeg_decode_postinit() failure
Last message repeated 10 times
[mpegts @ 0037b800] PES packet size mismatch
Input #0, mpegts, from 'tsfile.ts':
Duration: 00:01:30.58, start: 56297.848344, bitrate: 18045 kb/s
Program 1
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080  [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), s16, 384      kb/s

Here's a tsinfo.exe on the .ts file:

Reading from C:\tsfile.ts
Scanning 10000 TS packets

Packet 1 is PAT
Program list:
    Program 1 -> PID 0020 (32)

Packet 2 is PMT with PID 0020 (32)
  Program 1, version 1, PCR PID 0031 (49)
     Program info (38 bytes): 0e 03 c0 b9 16 10 06 c0 02 71 c0 04 00 0b 02 42 3f 05 04
                              47 41 39 34 86 0d e2 65 6e 67 7e 3f ff 65 6e 67 c1 3f ff
 maximum bitrate (3 bytes): c0 b9 16
 smoothing buffer (6 bytes): c0 02 71 c0 04 00
 system clock (2 bytes): 42 3f
 Registration GA94
 Descriptor tag 86 (134) (13 bytes): e2 65 6e 67 7e 3f ff 65 6e 67 c1 3f ff
  Program streams:
PID 0031 (  49) -> Stream type 02 (  2) H.262/13818-2 video (MPEG-2) or 11172-2 constrained video
PID 0034 (  52) -> Stream type 81 (129) User private
    ES info (6 bytes): 6a 04 41 43 2d 33
    DVB AC-3 (4 bytes): 41 43 2d 33

Found 14 PAT packets and 7 PMT packets in 10000 TS packets

解决方案

ffmpeg can select program stream as well as elementary stream within program. using map option and stream specifier. look at - http://superuser.com/questions/343716/ffmpeg-how-to-demux-live-multi-program-transport-stream

这篇关于FFmpeg的 - 从传输流文件中提取视频和音频(.TS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆