[FFmpeg-trac] #7693(undetermined:new): ffmpeg down-samples PCR on codec copy
FFmpeg
trac at avcodec.org
Tue Jan 22 17:56:45 EET 2019
#7693: ffmpeg down-samples PCR on codec copy
-------------------------------------+-------------------------------------
Reporter: gstair | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
When copying an MPEG2-TS video to a new file, specifying the codec option
to "copy" down-samples the program clock reference (PCR) rate in the MPEG2
container relative to the original PCR. The original video has a PCR every
~100-ms and the output file has a PCR every ~1100-ms*. In the log, it
states "muxrate VBR, pcr every 9000 pkts". The expected behavior would be
if there is no transcoding, the file would be copied directly and not have
a different PCR rate than the original file. This happens to all MPEG2-TS
files and all rebroadcasting methods (UDP, RTSP, file-direct)
*Using python to read the MPEG2-TS Headers and output the PCR to show
change in PCR.
How to reproduce:
{{{
%ffmpeg started on 2019-01-22 at 10:56:02
Report written to "ffmpeg-20190122-105602.log"
Command line:
"C:\\ffmpeg\\bin\\ffmpeg.exe" -report -v 9 -loglevel 99 -i
".\\Original_100ms_PCR.ts" -map 0 -f mpegts -c: copy
ReBroadcasted_1100ms_PCR.ts
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.1 (GCC) 20180722
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-
bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-
libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr
--enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2
--enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
--enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx
--enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-
nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
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
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a
report) with argument '1'.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument '99'.
Reading option '-i' ... matched as input url with argument
'.\Original_100ms_PCR.ts'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'mpegts'.
Reading option '-c:' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option 'ReBroadcasted_1100ms_PCR.ts' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Successfully parsed a group of options.
Parsing a group of options: input url .\Original_100ms_PCR.ts.
Successfully parsed a group of options.
Opening an input file: .\Original_100ms_PCR.ts.
[NULL @ 000001663f58be80] Opening '.\Original_100ms_PCR.ts' for reading
[file @ 000001663f58d000] Setting default whitelist 'file,crypto'
[mpegts @ 000001663f58be80] Format mpegts probed with size=2048 and
score=50
[mpegts @ 000001663f58be80] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 000001663f58be80] stream=1 stream_type=6 pid=101 prog_reg_desc=
[mpegts @ 000001663f58be80] Before avformat_find_stream_info() pos: 0
bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 000001663f58be80] parser not found for codec klv, packets or
times may be invalid.
[mpegts @ 000001663f58be80] parser not found for codec klv, packets or
times may be invalid.
[AVBSFContext @ 000001663fa1d3c0] nal_unit_type: 9, nal_ref_idc: 0
[AVBSFContext @ 000001663fa1d3c0] nal_unit_type: 7, nal_ref_idc: 3
[AVBSFContext @ 000001663fa1d3c0] nal_unit_type: 8, nal_ref_idc: 3
[AVBSFContext @ 000001663fa1d3c0] nal_unit_type: 6, nal_ref_idc: 0
[AVBSFContext @ 000001663fa1d3c0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 000001663f58db40] Format yuv420p chosen by get_format().
[h264 @ 000001663f58db40] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 000001663f58db40] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 000001663f58db40] nal_unit_type: 1, nal_ref_idc: 3
[mpegts @ 000001663f58be80] Probe buffer size limit of 5000000 bytes
reached
[mpegts @ 000001663f58be80] After avformat_find_stream_info() pos: 0 bytes
read:5787792 seeks:2 frames:188
Input #0, mpegts, from '.\Original_100ms_PCR.ts':
Duration: 00:00:07.52, start: 2.000000, bitrate: 9424 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100], 94, 1/90000: Video: h264 (Constrained Baseline), 1
reference frame ([27][0][0][0] / 0x001B), yuv420p(progressive, left),
1920x1080 (1920x1088), 0/1, 90k tbr, 90k tbn, 180k tbc
Stream #0:1[0x101], 94, 1/90000: Data: klv (KLVA / 0x41564C4B), 0/1
Successfully opened the file.
Parsing a group of options: output url ReBroadcasted_1100ms_PCR.ts.
Applying option map (set input stream mapping) with argument 0.
Applying option f (force format) with argument mpegts.
Applying option c: (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: ReBroadcasted_1100ms_PCR.ts.
[file @ 000001663f58fd40] Setting default whitelist 'file,crypto'
Successfully opened the file.
[mpegts @ 00000166406fe400] muxrate VBR, pcr every 9000 pkts, sdt every
200, pat/pmt every 40 pkts
Output #0, mpegts, to 'ReBroadcasted_1100ms_PCR.ts':
Metadata:
encoder : Lavf58.12.100
Stream #0:0, 0, 1/90000: Video: h264 (Constrained Baseline), 1
reference frame ([27][0][0][0] / 0x001B), yuv420p(progressive, left),
1920x1080 (0x0), 0/1, q=2-31, 90k tbr, 90k tbn, 90k tbc
Stream #0:1, 0, 1/90000: Data: klv (KLVA / 0x41564C4B), 0/1
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[NULL @ 000001663f58db40] nal_unit_type: 7, nal_ref_idc: 3
[NULL @ 000001663f58db40] nal_unit_type: 8, nal_ref_idc: 3
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
frame= 9 fps=0.0 q=-1.0 size= 256kB time=00:00:00.47
bitrate=4396.4kbits/s speed=0.93x
frame= 23 fps= 22 q=-1.0 size= 1280kB time=00:00:01.14
bitrate=9125.9kbits/s speed=1.11x
frame= 35 fps= 23 q=-1.0 size= 1792kB time=00:00:01.70
bitrate=8610.0kbits/s speed=1.11x
frame= 47 fps= 23 q=-1.0 size= 2560kB time=00:00:02.28
bitrate=9173.8kbits/s speed= 1.1x
frame= 81 fps= 31 q=-1.0 size= 4352kB time=00:00:03.90
bitrate=9132.0kbits/s speed=1.52x
frame= 144 fps= 47 q=-1.0 size= 7936kB time=00:00:07.00
bitrate=9280.8kbits/s speed=2.27x
No more output streams to write to, finishing.
frame= 152 fps= 48 q=-1.0 Lsize= 8654kB time=00:00:07.52
bitrate=9425.3kbits/s speed=2.38x
video:7955kB audio:0kB subtitle:0kB other streams:46kB global headers:0kB
muxing overhead: 8.159910%
Input file #0 (.\Original_100ms_PCR.ts):
Input stream #0:0 (video): 152 packets read (8146304 bytes);
Input stream #0:1 (data): 158 packets read (47242 bytes);
Total: 310 packets (8193546 bytes) demuxed
Output file #0 (ReBroadcasted_1100ms_PCR.ts):
Output stream #0:0 (video): 152 packets muxed (8146304 bytes);
Output stream #0:1 (data): 158 packets muxed (47242 bytes);
Total: 310 packets (8193546 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000016640587b00] Statistics: 0 seeks, 34 writeouts
[AVIOContext @ 000001663f595280] Statistics: 14649376 bytes read, 2 seeks
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7693>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list