[FFmpeg-trac] #3032(undetermined:new): Ffmpeg fails to stream copy mpeg2 TS files while trimming with av_interleaved_write_frame
FFmpeg
trac at avcodec.org
Mon Oct 7 21:11:52 CEST 2013
#3032: Ffmpeg fails to stream copy mpeg2 TS files while trimming with
av_interleaved_write_frame
-------------------------------------+-------------------------------------
Reporter: ramitbhalla | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug: In some cases when trying to stream copy a TS video
file while trimming some video at the beginning and at the end, it fails
with an error av_interleaved_write_frame Invalid Argument.
I try to use +genpts to fix the timestamp issues and it still eventually
fails.
See below:
without genpts it fails immediately
{{{
ffmpeg.2314Custom.exe -y -ss 10 -i "..\0 Channel mp1 Audio - HD.ts" -t
1767 -map 0:
a -map 0:v -vcodec copy -acodec copy test.ts
ffmpeg version N-56896-ga927276 Copyright (c) 2000-2013 the FFmpeg
developers
built on Oct 5 2013 09:46:09 with gcc 4.8.0 (GCC)
configuration: --arch=x86 --target-os=mingw32 --cross-
prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264
--enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-
libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype
--enable-libopus --disable-w32threads --enable-frei0r
--enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-
libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc
--enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-
cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libzvbi --enable-libcaca
--prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32
--enab
le-static --disable-shared --enable-libsoxr --enable-fontconfig --enable-
libass --enable-libutvideo --enable-libbluray -
-extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-runtime-
cpudetect
libavutil 52. 46.100 / 52. 46.100
libavcodec 55. 34.100 / 55. 34.100
libavformat 55. 19.100 / 55. 19.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 88.101 / 3. 88.101
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpeg, from '..\0 Channel mp1 Audio - HD.ts':
Duration: 00:29:47.23, start: 0.266733, bitrate: 11930 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt709),
1920x1080 [SAR 1:1 DAR 16:9], max. 11546 kb/s, 29.
97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Output #0, mpegts, to 'test.ts':
Metadata:
encoder : Lavf55.19.100
Stream #0:0: Audio: ac3, 48000 Hz, 5.1(side), 384 kb/s
Stream #0:1: Video: mpeg2video, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9],
q=2-31, max. 11546 kb/s, 29.97 fps, 90k tbn,
29.97 tbc
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0277d600] first pts value must be set
av_interleaved_write_frame(): Invalid data found when processing input
}}}
with +genpts it fails after a while
{{{
ffmpeg.2314Custom.exe -y -fflags +genpts -ss 10 -i "..\0 Channel mp1 Audio
- HD.ts"
-t 1767 -map 0:a -map 0:v -vcodec copy -acodec copy test.ts
ffmpeg version N-56896-ga927276 Copyright (c) 2000-2013 the FFmpeg
developers
built on Oct 5 2013 09:46:09 with gcc 4.8.0 (GCC)
configuration: --arch=x86 --target-os=mingw32 --cross-
prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264
--enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-
libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype
--enable-libopus --disable-w32threads --enable-frei0r
--enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-
libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc
--enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-
cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libzvbi --enable-libcaca
--prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32
--enab
le-static --disable-shared --enable-libsoxr --enable-fontconfig --enable-
libass --enable-libutvideo --enable-libbluray -
-extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-runtime-
cpudetect
libavutil 52. 46.100 / 52. 46.100
libavcodec 55. 34.100 / 55. 34.100
libavformat 55. 19.100 / 55. 19.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 88.101 / 3. 88.101
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpeg, from '..\0 Channel mp1 Audio - HD.ts':
Duration: 00:29:47.23, start: 0.266733, bitrate: 11930 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt709),
1920x1080 [SAR 1:1 DAR 16:9], max. 11546 kb/s, 29.
97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Output #0, mpegts, to 'test.ts':
Metadata:
encoder : Lavf55.19.100
Stream #0:0: Audio: ac3, 48000 Hz, 5.1(side), 384 kb/s
Stream #0:1: Video: mpeg2video, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9],
q=2-31, max. 11546 kb/s, 29.97 fps, 90k tbn,
29.97 tbc
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
3846245, current: 3846245; changing to 3846246. T
his may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
12494893, current: 12494893; changing to 12494894
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
12756155, current: 12756155; changing to 12756156
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
49636034, current: 49636034; changing to 49636035
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
53491890, current: 53491890; changing to 53491891
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
69885283, current: 69885283; changing to 69885284
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
82714111, current: 82714111; changing to 82714112
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
86557955, current: 86557955; changing to 86557956
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] Non-monotonous DTS in output stream 0:1; previous:
89648045, current: 89648045; changing to 89648046
. This may result in incorrect timestamps in the output file.
[mpegts @ 03439ec0] pts (89747144) < dts (89837234) in stream 1
av_interleaved_write_frame(): Invalid argument
}}}
It works fine if the video is converted to mpeg2:
{{{
ffmpeg.2314Custom.exe -y -fflags +genpts -ss 10 -i "..\0 Channel mp1 Audio
- HD.ts"
-t 1767 -map 0:a -map 0:v -vcodec mpeg2video -qscale 0 -acodec copy
test.ts
ffmpeg version N-56896-ga927276 Copyright (c) 2000-2013 the FFmpeg
developers
built on Oct 5 2013 09:46:09 with gcc 4.8.0 (GCC)
configuration: --arch=x86 --target-os=mingw32 --cross-
prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264
--enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-
libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype
--enable-libopus --disable-w32threads --enable-frei0r
--enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-
libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc
--enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-
cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libzvbi --enable-libcaca
--prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32
--enab
le-static --disable-shared --enable-libsoxr --enable-fontconfig --enable-
libass --enable-libutvideo --enable-libbluray -
-extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-runtime-
cpudetect
libavutil 52. 46.100 / 52. 46.100
libavcodec 55. 34.100 / 55. 34.100
libavformat 55. 19.100 / 55. 19.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 88.101 / 3. 88.101
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpeg, from '..\0 Channel mp1 Audio - HD.ts':
Duration: 00:29:47.23, start: 0.266733, bitrate: 11930 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt709),
1920x1080 [SAR 1:1 DAR 16:9], max. 11546 kb/s, 29.
97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, mpegts, to 'test.ts':
Metadata:
encoder : Lavf55.19.100
Stream #0:0: Audio: ac3, 48000 Hz, 5.1(side), 384 kb/s
Stream #0:1: Video: mpeg2video, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9],
q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (mpeg2video -> mpeg2video)
Press [q] to stop, [?] for help
[mpeg2video @ 03855700] 00 motion_type at 68 6300:00:58.58
bitrate=33725.0kbits/s dup=55 drop=0
[mpeg2video @ 03855700] 00 motion_type at 16 42
[mpeg2video @ 03855700] 00 motion_type at 5 43
[mpeg2video @ 03855700] ac-tex damaged at 26 44
[mpeg2video @ 03855700] ac-tex damaged at 39 45
[mpeg2video @ 03855700] 00 motion_type at 1 46
[mpeg2video @ 03855700] 00 motion_type at 10 47
[mpeg2video @ 03855700] 00 motion_type at 48 48
[mpeg2video @ 03855700] 00 motion_type at 7 49
[mpeg2video @ 03855700] 00 motion_type at 8 50
[mpeg2video @ 03855700] ac-tex damaged at 4 51
[mpeg2video @ 03855700] 00 motion_type at 10 52
[mpeg2video @ 03855700] 00 motion_type at 8 53
[mpeg2video @ 03855700] 00 motion_type at 9 54
[mpeg2video @ 03855700] ac-tex damaged at 12 55
[mpeg2video @ 03855700] 00 motion_type at 11 56
[mpeg2video @ 03855700] 00 motion_type at 8 57
[mpeg2video @ 03855700] ac-tex damaged at 7 58
[mpeg2video @ 03855700] ac-tex damaged at 3 59
[mpeg2video @ 03855700] 00 motion_type at 4 60
[mpeg2video @ 03855700] 00 motion_type at 13 61
[mpeg2video @ 03855700] ac-tex damaged at 7 62
[mpeg2video @ 03855700] 00 motion_type at 33 63
[mpeg2video @ 03855700] invalid mb type in P Frame at 52 64
[mpeg2video @ 03855700] ac-tex damaged at 16 65
[mpeg2video @ 03855700] 00 motion_type at 4 66
[mpeg2video @ 03855700] 00 motion_type at 15 67
[mpeg2video @ 03855700] Warning MVs not available
[mpeg2video @ 03855700] concealing 3120 DC, 3120 AC, 3120 MV errors in P
frame
[mpeg2video @ 03855700] 00 motion_type at 4 16
[mpeg2video @ 03855700] Warning MVs not available
[mpeg2video @ 03855700] concealing 1560 DC, 1560 AC, 1560 MV errors in P
frame
[mpeg2video @ 03855700] 00 motion_type at 63 2200:15:51.80
bitrate=26958.3kbits/s dup=631 drop=0
[mpeg2video @ 03855700] Warning MVs not available
[mpeg2video @ 03855700] concealing 120 DC, 120 AC, 120 MV errors in B
frame
frame=52958 fps= 46 q=0.0 Lsize= 5407271kB time=00:29:27.00
bitrate=25068.6kbits/s dup=1278 drop=0
video:4921717kB audio:81591kB subtitle:0 global headers:0kB muxing
overhead 8.073939%
}}}
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/3032>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list