我正在将.mkv文件转换为.mp4文件。我遇到的问题是声音不同步。正如您在日志中看到的那样,电影播放的时间越长,音频和视频的同步越接近。
现在,我的问题是,有没有办法避免这种情况发生?
➜ ~ ffmpeg -i mkv.mkv -vcodec copy -acodec copy mkv.mp4
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, matroska,webm, from 'mkv.mkv':
Metadata:
ENCODER : Lavf53.24.2
Duration: 00:00:34.08, start: -1.400000, bitrate: 1232 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
Output #0, mp4, to 'mkv.mp4':
Metadata:
encoder : Lavf57.56.100
Stream #0:0: Video: mpeg4 (Simple Profile) ( [0][0][0] / 0x0020), yuv420p, 720x480 [SAR 1:1 DAR 3:2], q=2-31, 25 fps, 25 tbr, 16k tbn, 1k tbc (default)
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1 (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132736, current: 67440; changing to 132737. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132737, current: 68472; changing to 132738. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132738, current: 69496; changing to 132739. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132739, current: 70520; changing to 132740. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132740, current: 71544; changing to 132741. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132741, current: 72568; changing to 132742. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132742, current: 73592; changing to 132743. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132743, current: 74616; changing to 132744. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132744, current: 75640; changing to 132745. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132745, current: 76664; changing to 132746. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132746, current: 77688; changing to 132747. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132747, current: 78712; changing to 132748. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132748, current: 79736; changing to 132749. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132749, current: 80760; changing to 132750. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132750, current: 81784; changing to 132751. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132751, current: 82808; changing to 132752. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132752, current: 83832; changing to 132753. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132753, current: 84856; changing to 132754. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132754, current: 85880; changing to 132755. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132755, current: 86904; changing to 132756. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132756, current: 87928; changing to 132757. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132757, current: 88952; changing to 132758. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132758, current: 89976; changing to 132759. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132759, current: 91000; changing to 132760. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132760, current: 92024; changing to 132761. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132761, current: 93048; changing to 132762. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132762, current: 94072; changing to 132763. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132763, current: 95096; changing to 132764. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132764, current: 96120; changing to 132765. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132765, current: 97144; changing to 132766. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132766, current: 98168; changing to 132767. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132767, current: 99192; changing to 132768. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132768, current: 100216; changing to 132769. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132769, current: 101240; changing to 132770. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132770, current: 102264; changing to 132771. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132771, current: 103288; changing to 132772. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132772, current: 104312; changing to 132773. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132773, current: 105336; changing to 132774. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132774, current: 106360; changing to 132775. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132775, current: 107384; changing to 132776. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132776, current: 108408; changing to 132777. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132777, current: 109432; changing to 132778. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132778, current: 110456; changing to 132779. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132779, current: 111480; changing to 132780. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132780, current: 112504; changing to 132781. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132781, current: 113528; changing to 132782. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132782, current: 114552; changing to 132783. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132783, current: 115576; changing to 132784. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132784, current: 116600; changing to 132785. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132785, current: 117624; changing to 132786. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132786, current: 118648; changing to 132787. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132787, current: 119672; changing to 132788. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132788, current: 120696; changing to 132789. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132789, current: 121720; changing to 132790. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132790, current: 122744; changing to 132791. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132791, current: 123768; changing to 132792. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132792, current: 124792; changing to 132793. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132793, current: 125816; changing to 132794. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132794, current: 126840; changing to 132795. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132795, current: 127864; changing to 132796. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132796, current: 128888; changing to 132797. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132797, current: 129912; changing to 132798. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132798, current: 130936; changing to 132799. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd7b1003200] Non-monotonous DTS in output stream 0:1; previous: 132799, current: 131960; changing to 132800. This may result in incorrect timestamps in the output file.
frame= 887 fps=0.0 q=-1.0 Lsize= 5130kB time=00:00:35.45 bitrate=1185.4kbits/s speed= 668x
video:3447kB audio:1663kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.401607%
谢谢你们所有的帮助。我似乎无法找到答案......
当我跑步时,
—
Chris Palmer Breuer 2017年
ffmpeg -y -i mkv.mkv -movflags faststart -c:v libx264 -avoid_negative_ts mkv.mp4
我收到这个错误:At least one output file must be specified
。谢谢你的帮助Mulvya!
你错过了价值
—
吉安
make_zero
哦不,我的坏!抱歉! 不幸的是,尽管如此,
—
Chris Palmer Breuer 2017年
make_zero
我仍然收到不同步的音频和Non-monotonous DTS in output stream
。
不要担心DTS消息。你是怎么玩这个文件的?
—
Gyan 2017年
ss
t
你的情况。您可能需要重新编码音频。如果是的话会提供命令。