[FFmpeg-user] Encode to timestamp on ts with "holes"

Gabriele Greco gabrielegreco at gmail.com
Tue Mar 5 13:31:30 EET 2019


Hi guys,

I'm trying to encode part of a video in a particular source timestamp
range, from input .ts files got from satellite inputs that can have "holes"
(due to signal issues).

Actually what I do basically is:

ffmpeg -ss start_ts -i input.ts -to (end_ts - start_ts) out.mp4

this can work only if the input file has no holes...

so after reading ffmpeg documentation and various stackoverflow questions I
decided that copyts was my friend to achieve my result and I tried:

ffmpeg -ss start_ts -copyts -i input.ts -to end_ts out.mp4
ffmpeg -ss start_ts -i input.ts -copyts -to end_ts out.mp4

(documentation does not tell if -copyts is an input or output parameter,
anyway the result is the same)

... with copyts the operation fails (full output below), there is a way to
end my encoding process to a given input timestamp also with partially
broken files that do not like -copyts ?


ffmpeg -y -copyts -ss 4837.0 -i "/Users/gabry/Desktop/test.ts"  -to 7723.0
-s 320x200 test.mp4

ffmpeg version N-92313-g4a6d5f3cad Copyright (c) 2000-2018 the FFmpeg
developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
  configuration: --disable-videotoolbox --disable-audiotoolbox
--enable-libx264 --enable-libfdk-aac --enable-nonfree --enable-gpl
  libavutil      56. 21.100 / 56. 21.100
  libavcodec     58. 34.100 / 58. 34.100
  libavformat    58. 19.102 / 58. 19.102
  libavdevice    58.  4.106 / 58.  4.106
  libavfilter     7. 38.100 /  7. 38.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[mp3float @ 0x7fb72e804c00] Header missing
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] SPS unavailable in decode_picture_timing
[h264 @ 0x7fb72e804000] non-existing PPS 0 referenced
[h264 @ 0x7fb72e804000] decode_slice_header error
[h264 @ 0x7fb72e804000] no frame!
[mpegts @ 0x7fb72e800000] PES packet size mismatch
Input #0, mpegts, from '/Users/gabry/Desktop/DONE_20190303 1145 - Eurosport
2 HD (D) - _0140_(g-65956)_sonderjyske-randers_2019_03_03.ts':
  Duration: 03:00:00.42, start: 64243.156089, bitrate: 11276 kb/s
  Program 4706
  Program 4704
  Program 4701
  Program 4702
  Program 4707
  Program 4703
  Program 4705
  Program 7072
    Stream #0:0[0x4e2]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25
tbr, 90k tbn, 50 tbc
    Stream #0:1[0xd23](dan): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 256 kb/s
  Program 7159
  Program 4901
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7fb72f82b600] co located POCs unavailable
[h264 @ 0x7fb72f828600] co located POCs unavailable
[mp2 @ 0x7fb730002000] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[libx264 @ 0x7fb72f825000] using SAR=10/9
[libx264 @ 0x7fb72f825000] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fb72f825000] profile High, level 1.3
[libx264 @ 0x7fb72f825000] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC
codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf58.19.102
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
320x200 [SAR 10:9 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.34.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(dan): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.34.100 aac
frame=    0 fps=0.0 q=0.0 Lsize=       1kB time=19:11:20.17 bitrate=
 0.0kbits/s speed=3.47e+05x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 167.276428%

-- 
Bye,
 Gabry


More information about the ffmpeg-user mailing list