Opened 4 years ago

Closed 3 years ago

#4354 closed defect (needs_more_info)

Big file size difference after using -c:v copy and -c:a copy

Reported by: Atarikid Owned by:
Priority: normal Component: undetermined
Version: 2.5.2 Keywords: mpegts
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Timothy_Gu)

I noticed some very strange when copying streams.

You can reproduce this with any .m2t or .ts source file.
Just copy the streams with -c:v copy -c:a copy

Note the below example source file has 1 video stream and 1 audio stream.
Do notice the BITRATE has changed from 27253 kb/s to 19490 kb/s
How can this be the case when you copy the streams?

Here is command line and output. Below you can find the ffmpeg info of both source and created file (about %25 smaller in file size)

/Users/atarikid/Library/Application\ Support/iFFmpeg5/FFmpeg  -i /Volumes/Data/movies/snl\ alabama\ shakes.m2t -c:a copy -c:v copy -f mpegts -y /Users/atarikid/Movies/snl\ alabama\ shakes.ts

ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  1 2015 20:24:48 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/tempdisk/sw --as=yasm --enable-gpl --enable-pthreads --disable-ffplay --disable-ffserver --disable-shared --enable-static --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-zlib --enable-avfilter --enable-fontconfig --enable-libfreetype --enable-libass --enable-libutvideo --enable-filters --enable-postproc --enable-runtime-cpudetect
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[mpeg2video @ 0x7faf3b824200] Invalid frame dimensions 0x0.
    Last message repeated 1 times
    Last message repeated 2 times
    Last message repeated 3 times
    Last message repeated 4 times
    Last message repeated 5 times
    Last message repeated 6 times
    Last message repeated 7 times
    Last message repeated 8 times
    Last message repeated 9 times
    Last message repeated 10 times
    Last message repeated 11 times
    Last message repeated 12 times
    Last message repeated 13 times
    Last message repeated 14 times
    Last message repeated 14 times
[mpegts @ 0x7faf3b81bc00] PES packet size mismatch
Input #0, mpegts, from '/Volumes/Data/movies/snl alabama shakes.m2t':
  Duration: 00:04:52.51, start: 62014.858256, bitrate: 27253 kb/s
  Program 1 
    Stream #0:0[0xec9]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], max. 25000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0xeca]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
Output #0, mpegts, to '/Users/atarikid/Movies/snl alabama shakes.ts':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, max. 25000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Stream #0:1: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), 384 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 2243 fps=0.0 q=-1.0 size=  170284kB time=00:01:15.78 bitrate=18406.0kbits/s    
frame= 4274 fps=4273 q=-1.0 size=  337113kB time=00:02:23.55 bitrate=19237.2kbits/s    
frame= 5618 fps=3745 q=-1.0 size=  447000kB time=00:03:08.40 bitrate=19436.3kbits/s    
frame= 7700 fps=3849 q=-1.0 size=  617824kB time=00:04:17.87 bitrate=19626.9kbits/s    
[mpegts @ 0x7faf3b81bc00] PES packet size mismatch
frame= 8737 fps=3910 q=-1.0 Lsize=  695950kB time=00:04:52.47 bitrate=19493.2kbits/s    
video:629879kB audio:13695kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.138343%

Original:
Filesize = 996.468.808bytes (996,5MB)

Last login: Thu Mar  5 15:42:41 on console
atarikids-MacBook-Pro:~ atarikid$ /Users/atarikid/Desktop/ffmpeg -i /Volumes/Data/movies/snl\ alabama\ shakes.m2t
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  1 2015 20:24:48 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/tempdisk/sw --as=yasm --enable-gpl --enable-pthreads --disable-ffplay --disable-ffserver --disable-shared --enable-static --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-zlib --enable-avfilter --enable-fontconfig --enable-libfreetype --enable-libass --enable-libutvideo --enable-filters --enable-postproc --enable-runtime-cpudetect
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from '/Volumes/Data/movies/snl alabama shakes.m2t':
  Duration: 00:04:52.51, start: 62014.858256, bitrate: 27253 kb/s
  Program 1 
    Stream #0:0[0xec9]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], max. 25000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0xeca]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
At least one output file must be specified
atarikids-MacBook-Pro:~ atarikid$ 

Passthru version:
Filesize = 712.652.728bytes (712,7MB)

atarikids-MacBook-Pro:~ atarikid$ /Users/atarikid/Desktop/ffmpeg -i /Users/atarikid/Desktop/snl\ alabama\ shakes.ts
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  1 2015 20:24:48 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/tempdisk/sw --as=yasm --enable-gpl --enable-pthreads --disable-ffplay --disable-ffserver --disable-shared --enable-static --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-zlib --enable-avfilter --enable-fontconfig --enable-libfreetype --enable-libass --enable-libutvideo --enable-filters --enable-postproc --enable-runtime-cpudetect
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from '/Users/atarikid/Desktop/snl alabama shakes.ts':
  Duration: 00:04:52.51, start: 1.400000, bitrate: 19490 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], max. 25000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
At least one output file must be specified

Change History (8)

comment:1 Changed 4 years ago by Atarikid

Any luck with this?

comment:2 Changed 4 years ago by Timothy_Gu

  • Description modified (diff)

comment:3 in reply to: ↑ description Changed 4 years ago by AndyF

Replying to Atarikid:

I noticed some very strange when copying streams.

You can reproduce this with any .m2t or .ts source file.
Just copy the streams with -c:v copy -c:a copy

Note the below example source file has 1 video stream and 1 audio stream.
Do notice the BITRATE has changed from 27253 kb/s to 19490 kb/s
How can this be the case when you copy the streams?

Transport streams may contain null packets to pad out bandwidth to a fixed value which could account for it.

I've never used one, but search for transport stream analyzer and I guess you will be able to find something to look at your streams. Null packets have pid 0x1fff (8191).

comment:4 follow-up: Changed 4 years ago by Atarikid

That could only explain why the new new file is smaller. What about the changed bitrate?

comment:5 in reply to: ↑ 4 Changed 4 years ago by AndyF

Replying to Atarikid:

That could only explain why the new new file is smaller. What about the changed bitrate?

Above looks to me that the the bitrates are called for the whole ts.

the last 2 ffmpeg -i outputs show "max 25000" for the actual mpeg2video stream.

I expect that the variable bitrates shown in the first output are accurate for the video stream. but nowhere else really contradicts them.

When doing just ffmpeg -i infile bitrate estimations are just based on looking at a small bit of the start of the file, so the fact that the last output "19490" is less than the 19626.9 that is visible in the first output I expect is just due to that.

comment:6 Changed 4 years ago by cehoyos

Please test current FFmpeg git head and please explain your issue: Smaller filesize is usually seen as a feature, not a bug.

comment:7 Changed 4 years ago by cehoyos

  • Keywords mpegts added

comment:8 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.