Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.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
ffmpeg解复用成音频和视频重置PTS_Ffmpeg - Fatal编程技术网

ffmpeg解复用成音频和视频重置PTS

ffmpeg解复用成音频和视频重置PTS,ffmpeg,Ffmpeg,解组 我将TS片段分解为音频和视频,如下所示 ffmpeg -y -i input.ts -vcodec copy -an output_video.ts ffmpeg -y -i input.ts -acodec copy -vn output_audio.aac 检查输入 input.ts上的start_pts和start_time如下所示。我能够使用ffprobe-show\u streams-print\u格式的json input.ts检查这些值 "start_pts": 83065

解组

我将TS片段分解为音频和视频,如下所示

ffmpeg -y -i input.ts -vcodec copy -an output_video.ts
ffmpeg -y -i input.ts -acodec copy -vn output_audio.aac
检查输入

input.ts上的
start_pts
start_time
如下所示。我能够使用
ffprobe-show\u streams-print\u格式的json input.ts检查这些值

"start_pts": 8306558438,
"start_time": "92295.093756",
检查输出视频

output.ts有一些默认的
start_pts
start_time
值,如下所示。也可使用与上述相同的
ffprobe
命令获取这些数据

"start_pts": 126000,
"start_time": "1.400000",
检查输出音频

output\u audio.aac
上的相同
ffprobe
命令显示输出aac具有无效的
codec\u标签
codec\u标签字符串
,如下所示。
output\u audio.aac
中不存在
start\u pts
start\u time

"codec_tag_string": "[0][0][0][0]", (should have been [15][0][0][0])
"codec_tag": "0x0000", (should have been 0xf000)
问题

  • 想知道
    开始时间
    开始时间
    编解码器标签
    是否会出现这种差异
  • 如果是预期的,我可以做些什么来确保所有这些参数都保留在输出上
  • 如果这不是预期的,是否有更多的信息我可以分享来追踪这一点
  • output\u audio.aac
    ffprobe
    命令中,我发现其他输出不一致,如
    duration等。在这一点上,我分享了我认为最有价值的东西。如果需要,我可以分享上述所有执行的完整输出

    [编辑2018年7月30日-MST时间08:00] ffmpeg-y-i input.ts-vcodec copy-an output\u video.ts-acodec copy-vn output\u audio.aac的日志如下所示

    ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
      built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree
      libavutil      56. 14.100 / 56. 14.100
      libavcodec     58. 18.100 / 58. 18.100
      libavformat    58. 12.100 / 58. 12.100
      libavdevice    58.  3.100 / 58.  3.100
      libavfilter     7. 16.100 /  7. 16.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  1.100 /  5.  1.100
      libswresample   3.  1.100 /  3.  1.100
      libpostproc    55.  1.100 / 55.  1.100
    [mpegts @ 0x7f88ed803000] start time for stream 0 is not set in estimate_timings_from_pts
    Input #0, mpegts, from 'i7h9456s_media_46185.ts':
      Duration: 00:00:06.05, start: 86216.852667, bitrate: 2898 kb/s
      Program 1 
        Stream #0:0[0x102]: Data: timed_id3 (ID3  / 0x20334449)
        Stream #0:1[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m, progressive), 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
        Stream #0:2[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 190 kb/s
    Output #0, mpegts, to '../output_video.ts':
      Metadata:
        encoder         : Lavf58.12.100
        Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Output #1, adts, to '../output_audio.aac':
      Metadata:
        encoder         : Lavf58.12.100
        Stream #1:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 190 kb/s
    Stream mapping:
      Stream #0:1 -> #0:0 (copy)
      Stream #0:2 -> #1:0 (copy)
    Press [q] to stop, [?] for help
    frame=  180 fps=0.0 q=-1.0 Lsize=    2088kB time=00:00:06.03 bitrate=2833.8kbits/s speed= 904x    
    video:1918kB audio:142kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.349750%
    

    所有的差异都是意料之中的。FFmpeg删除输入时间戳偏移量,除非另有设置。MPEG-TS多路复用器还添加了时间戳偏移

    您可以在重排TS时保留源时间戳,也可以避免muxer的偏移,如下所示

    ffmpeg -y -copyts -i input.ts -vcodec copy -an -muxdelay 0 -muxpreload 0 output_video.ts
    

    由于
    .aac
    是原始ADTS流,因此不存在编解码器标记字符串。这是意料之中的。Mux到
    .m4a
    .mka
    或类似容器(如果需要标记)。

    请共享
    ffmpeg-y-i input.ts-vcodec copy-an output\u video.ts-acodec copy-vn output\u audio.aac的完整日志。我已经发布了日志。非常感谢你的帮助。任何方向都将受到极大的赞赏。因此,我猜,
    copyts
    就是复制所有参数的东西。我不确定是否要避免复用器的偏移。我想避免复用器偏移的原因是什么?