| Branch: | Revision:

ffmpeg / libavformat / mpegtsenc.c @ 4dcde00c

History | View | Annotate | Download (32.1 KB)

# Date Author Comment
2912e87a 03/19/2011 01:33 PM Mans Rullgard

Replace FFmpeg with Libav in licence headers

Signed-off-by: Mans Rullgard <>

b7f2fdde 03/17/2011 02:59 AM Anton Khirnov

avio: rename put_flush_packet -> avio_flush

Signed-off-by: Ronald S. Bultje <>

435cebd0 03/07/2011 07:43 PM Anssi Hannula

mpegtsenc: handle multiple language tags per stream

Signed-off-by: Ronald S. Bultje <>

a2704c97 03/04/2011 04:26 PM Anton Khirnov

avio: add avio_tell macro as a replacement for url_ftell

Signed-off-by: Ronald S. Bultje <>

6c065f0a 02/21/2011 11:57 PM Tony Strauss

mpegtsenc: use correct PES stream_id for AAC

This adds the AAC codec to the list of audio codecs that results
in a PES stream_id of 0xc0 (audio stream).

Signed-off-by: Mans Rullgard <>

77eb5504 02/21/2011 07:25 PM Anton Khirnov

avio: avio: avio_ prefixes for put_* functions

In the name of consistency:
put_byte -> avio_w8
put_<type> -> avio_w<type>
put_buffer -> avio_write

put_nbyte will be made private
put_tag will be merged with avio_put_str

Signed-off-by: Ronald S. Bultje <>

ae628ec1 02/20/2011 01:37 PM Anton Khirnov

avio: rename ByteIOContext to AVIOContext.

Signed-off-by: Ronald S. Bultje <>

2dd1ee4b 02/14/2011 11:18 PM Mans Rullgard

mpegtsenc: whitespace cosmetics

Signed-off-by: Mans Rullgard <>

3f2d3a19 02/14/2011 11:18 PM Anssi Hannula

mpegtsenc: set audio_type according to st->disposition

Signed-off-by: Mans Rullgard <>

740ad0d1 01/31/2011 04:58 PM Mans Rullgard

mpegtsenc: fix PMT PID calculation

445996aa51f4f1d9a26456a8511988291a720ba0 caused the PMT PID to be
off by one. This corrects it.

Signed-off-by: Mans Rullgard <>

445996aa 01/31/2011 03:42 PM Georgi Chorbadzhiyski

Replace defines in libavformat/mpegtsenc.c with AVOptions

Around 01/28/11 18:56, Ronald S. Bultje scribbled:

That patch is now merged, can you submit the update to muxers.texi?
Then we'll apply the whole thing.

See attached. I hope the documentation is enough....

4d54df8e 01/28/2011 10:33 PM Peter Ross

mpegtsenc: support CODEC_ID_AAC_LATM

$subject. Have used this for loopback testing with mpegts.c.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
[2. text/x-diff; 0001-mpegtsenc-support-CODEC_ID_AAC_LATM.patch]

From 0f7f9db4b7da1793996af6dda84298507703759a Mon Sep 17 00:00:00 2001...

a7827a17 01/28/2011 04:46 PM Georgi Chorbadzhiyski

In mpegts "reserved_future_use" field must be set to 1 in SDT table

According to EN 300 468 section 3.1 (Definitions):

Unless otherwise specified within the present document all
"reserved_future_use" bits is set to "1".

This was not the case for SDT generation so this patch fixes it....

c6610a21 01/26/2011 10:10 PM Diego Elio Pettenò

Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice.

This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.

535638b5 01/26/2011 12:02 AM Georgi Chorbadzhiyski

mpegtsenc: set reserved bits to 1 in PCR field

The reserved bits between PCR base and extension fields must be
set to 1.

Signed-off-by: Mans Rullgard <>

6e78c8ee 01/25/2011 12:52 PM Georgi Chorbadzhiyski

mpegtsenc: remove unused variables

Remove two variables that were not used and caused the following

CC libavformat/mpegtsenc.o
libavformat/mpegtsenc.c: In function 'mpegts_write_section':
libavformat/mpegtsenc.c:72:18: warning: unused variable 'ts'...

e5fe6551 01/20/2011 02:28 PM Janne Grunau

mpegtsenc: prefer metadata keyed with "service_name"

title metadata is only used as fallback if no service_name is available.

Signed-off-by: Janne Grunau <>

69688e71 01/20/2011 11:31 AM Georgi Chorbadzhiyski

Add service_provider and service_name metadata

This patch adds support in mpegts muxer for using service_provider and
service_name metadata to set service_provider_name and service_name
fields in SDT.

Example usage:
ffmpeg -i file.ts -f mpegts -re -acodec copy -vcodec copy -f mpegts \...

66be80d6 12/03/2010 01:26 PM Tomas Härdin

mpegtsenc: Improve PCR generation and output
This fixes PCR drift due to accumulating TS_PACKET_SIZE*8*90000LL/ts->mux_rate each packet, due to rounding errors when mux_rate does not evenly divide 135360000.
This patch also increases the PCR precision to 27 MHz from 90 kHz and takes the location of the PCR data into account (+11 bytes according to the spec)....

16209390 09/27/2010 12:27 PM Tomas Härdin

mpegtsenc: Indent

Originally committed as revision 25222 to svn://

d1ac0351 09/27/2010 12:27 PM Tomas Härdin

mpegtsenc: Write subtitle extradata if set

Originally committed as revision 25221 to svn://

ef011e6d 07/23/2010 12:27 AM Baptiste Coudurier

In mpegts muxer, fix rbsp trailing bits in AUD nal, fixes issue #2122

Originally committed as revision 24449 to svn://

8fc0162a 07/10/2010 10:12 PM Måns Rullgård

Add av_ prefix to bswap macros

Originally committed as revision 24170 to svn://

efdccce5 07/08/2010 10:01 PM Baptiste Coudurier

In mpegts muxer, print VBR instead of dummy 1 when displaying muxrate

Originally committed as revision 24125 to svn://

ea59f489 07/01/2010 11:21 PM Måns Rullgård

mpegtsenc: allocate correct size for PID table

Originally committed as revision 23951 to svn://

5fd48573 06/30/2010 10:39 PM Mike Scheutzow

Allow setting streamid when muxing mpegts.

Patch by Mike Scheutzow, scheutzow alcatel-lucent com

Originally committed as revision 23918 to svn://

9a2cb05f 04/11/2010 09:44 PM Stefano Sabatini

Move the internal function declarations in avformat.h to internal.h.

Originally committed as revision 22843 to svn://

2874c81c 04/03/2010 02:15 PM Stefano Sabatini

Replace all remaining occurrences of AVERROR_NOMEM with

AVERROR_NOMEM is deprecated and will be dropped at the next libavutil
major bump.

Originally committed as revision 22791 to svn://

72415b2a 03/30/2010 11:30 PM Stefano Sabatini

Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.

Originally committed as revision 22735 to svn://

83c2bc7a 03/10/2010 09:20 AM Baptiste Coudurier

In mpegts muxer, free adts context and temporary data

Originally committed as revision 22428 to svn://

e3433702 03/10/2010 09:19 AM Baptiste Coudurier


Originally committed as revision 22427 to svn://

8fdd542c 03/09/2010 12:18 AM Baptiste Coudurier

In mpegts muxer, write adts header if aac bitstream does not contain it

Originally committed as revision 22355 to svn://

e17d77bb 03/08/2010 11:59 PM Baptiste Coudurier

In mpegts muxer, search for h264 aud nal, it might not be the first nal.
Improve ther error message when bitstream is malformated and tell user to use
the bitstream filter.

Originally committed as revision 22354 to svn://

7082ea56 03/08/2010 11:46 PM Baptiste Coudurier

mpegts vbr muxing, activated when muxing rate is not supplied by the

Originally committed as revision 22352 to svn://

677a1144 03/08/2010 10:44 PM Baptiste Coudurier

Start continuity counter at 0 for pmt as well

Originally committed as revision 22350 to svn://

d73a458f 03/08/2010 08:59 PM Baptiste Coudurier

Start continuity counter at 0 for streams

Originally committed as revision 22344 to svn://

9169174f 03/08/2010 08:57 PM Baptiste Coudurier

10l typo, fix ts total bit rate computation

Originally committed as revision 22343 to svn://

8d819221 02/24/2010 10:56 AM Yann Coupin

Correctly increment continuity_counter in PCR packets.

Patch by Yann Coupin, yann.coupin+ffmpeg gmail

Originally committed as revision 22020 to svn://

a1f42882 01/13/2010 10:57 PM Baptiste Coudurier

revert wrongly commited hunk in r21205

Originally committed as revision 21207 to svn://

dcc2220a 01/13/2010 10:50 PM Baptiste Coudurier

remove useless declarations from mpegts.h

Originally committed as revision 21205 to svn://

33931016 01/13/2010 10:23 PM Baptiste Coudurier

use codec rc_max_rate if set and warn if bit rate is not set

Originally committed as revision 21204 to svn://

01d6bd52 01/13/2010 10:21 PM Baptiste Coudurier

Do not split audio frames accross pes packets.
This was not supported by some equipment and cisco analyzer.

Originally committed as revision 21203 to svn://

907d9166 01/13/2010 09:42 PM Mike Scheutzow

print more debug info about muxing parameters, patch by Mike Scheutzow, scheutzow at alcatel-lucent dot com

Originally committed as revision 21201 to svn://

c054f372 01/13/2010 09:40 PM Mike Scheutzow

update mpegts_write_pes documentation, patch by Mike Scheutzow, scheutzow at alcatel-lucent dot com

Originally committed as revision 21200 to svn://

4df3bbbc 01/13/2010 08:44 PM Mike Scheutzow

Insert null packets to keep pcr values correct, patch by Mike Scheutzow,
scheutzow at alcatel-lucent dot com and Niobos, niobos at dest-unreach dot be.

Originally committed as revision 21199 to svn://

49f6fd8f 01/13/2010 08:30 PM Mike Scheutzow

move pcr/sdt/pat period computation after ts->mux_rate is set, patch by Mike Scheutzow, scheutzow at alcatel-lucent dot com

Originally committed as revision 21198 to svn://

6b18a3f5 01/13/2010 08:26 PM Mike Scheutzow

output a pcr as soon as possible, patch by Mike Scheutzow, scheutzow at alcatel-lucent dot com

Originally committed as revision 21197 to svn://

906c16a1 01/13/2010 08:20 PM Niobos

fix ts packet header size computation, patch by Niobos, niobos at dest-unreach dot be

Originally committed as revision 21196 to svn://

080cabff 01/13/2010 08:14 PM Niobos

fix sdt, pat, pcr size computation, patch by Niobos, niobos at dest-unreach dot be

Originally committed as revision 21195 to svn://

807e4e81 10/18/2009 09:41 PM Baptiste Coudurier

mux all stream types except audio as one pes packet per avpacket, issue #1374

Originally committed as revision 20292 to svn://

9deba199 09/17/2009 07:07 PM Niobos

fix pes overhead computation, patch by Niobos, niobos at dest-unreach dot be

Originally committed as revision 19902 to svn://

1aae3489 07/28/2009 05:51 PM Niobos

rename freq to period which is more correct, patch by Niobos, niobos dot be at gmail dot com

Originally committed as revision 19529 to svn://

84df78b4 05/23/2009 06:25 AM Baptiste Coudurier

simplify pes timestamps fetching, based on a patch by corp186, chasedouglas at gmail dot com

Originally committed as revision 18910 to svn://

c69d2241 05/23/2009 06:09 AM corp186

compute total bitrate more accurately, patch by corp186, chasedouglas at gmail dot com

Originally committed as revision 18909 to svn://

24ac5052 05/11/2009 02:36 AM Baptiste Coudurier

move free data in the video case

Originally committed as revision 18793 to svn://

e4358e70 05/11/2009 02:30 AM Baptiste Coudurier

write a single pes for video frames, some proprietary player needs it

Originally committed as revision 18792 to svn://

b69017af 05/10/2009 01:57 AM Baptiste Coudurier

ensure first pts is set, according to specs

Originally committed as revision 18781 to svn://

1e885788 05/10/2009 01:41 AM Baptiste Coudurier

remove useless max_payload_size variable

Originally committed as revision 18780 to svn://

8f14cdee 05/10/2009 01:37 AM Baptiste Coudurier

do not write dts if pts is not set

Originally committed as revision 18779 to svn://

31df40a1 05/10/2009 01:02 AM Baptiste Coudurier

fix total bitrate computation, based on patch by corp186, chasedouglas at gmail dot com

Originally committed as revision 18778 to svn://

4b358c3e 02/18/2009 12:00 AM Aurelien Jacobs

use new metadata API in mpegts muxer

Originally committed as revision 17406 to svn://

406792e7 01/19/2009 03:46 PM Diego Biurrun

cosmetics: Remove pointless period after copyright statement non-sentences.

Originally committed as revision 16684 to svn://

f3ba7c54 01/15/2009 01:47 AM Baptiste Coudurier

use delay for subs and dirac too

Originally committed as revision 16614 to svn://

a57fb91c 01/15/2009 01:22 AM Baptiste Coudurier

add aud nal unit if not present in h264 bitstream

Originally committed as revision 16613 to svn://

89ac55ad 01/14/2009 11:53 PM Baptiste Coudurier

consider other codecs packets contain only one access unit, not just audio

Originally committed as revision 16611 to svn://

3d0a94f6 01/14/2009 11:49 PM Baptiste Coudurier

calculate pat, pmt and sdt exact size and adjust total bitrate

Originally committed as revision 16610 to svn://

620b9df7 01/14/2009 11:30 PM Baptiste Coudurier

allow user to specify muxrate

Originally committed as revision 16609 to svn://

811a0aa7 01/14/2009 10:40 PM Baptiste Coudurier

warn if dts < pcr which means TS is invalid

Originally committed as revision 16607 to svn://

5541759f 01/14/2009 10:17 PM Baptiste Coudurier

only write dts if they differ from pts, according to specs

Originally committed as revision 16605 to svn://

46911c7a 01/14/2009 10:14 PM Baptiste Coudurier

use delay to avoid negative dts

Originally committed as revision 16604 to svn://

de34dc39 01/14/2009 09:57 PM Baptiste Coudurier

set pts and dts of pes packets exactly according to specs

Originally committed as revision 16603 to svn://

b5931348 01/14/2009 02:20 AM Baptiste Coudurier

compute pcr more accurately, regression tests need update

Originally committed as revision 16596 to svn://

6a5d31ac 01/11/2009 10:19 PM Diego Biurrun

Fix build: Add intreadwrite.h and bswap.h #includes where necessary.

Originally committed as revision 16556 to svn://

67a38cee 08/14/2008 11:17 AM Anuradha Suraparaju

Change Dirac in MPEG-TS encapsulation to conform with spec changes.
patch by Anuradha Suraparaju, anuradha uk

Originally committed as revision 14753 to svn://

f4bba201 08/13/2008 07:29 PM Anuradha Suraparaju

Dirac encapsulation in MPEG-TS
patch by Anuradha Suraparaju, anuradha uk

Originally committed as revision 14734 to svn://

bde15e74 06/03/2008 04:20 PM Stefano Sabatini

Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
patch by Stefano Sabatini, stefano.sabatini-lala
along with some spelling/consistency fixes for the long names by me

Originally committed as revision 13649 to svn://

d3ad044a 06/03/2008 12:55 AM Baptiste Coudurier

add pretty common .m2t as ts extension

Originally committed as revision 13642 to svn://

3654a16d 06/03/2008 12:53 AM Baptiste Coudurier

fix continuity counter to start at 0

Originally committed as revision 13641 to svn://

245976da 05/09/2008 11:56 AM Diego Biurrun

Use full path for #includes from another directory.

Originally committed as revision 13098 to svn://

3abe5fbd 01/04/2008 11:09 PM Aurelien Jacobs

improve CRC API
- don't export any global var
- provide either generated or hardcoded tables

Originally committed as revision 11409 to svn://

899681cd 11/21/2007 07:41 AM Björn Axelsson

Use dynamically allocated ByteIOContext in AVFormatContext

patch by: Björn Axelsson, bjorn d axelsson a intinor d se
thread: [PATCH] Remove static ByteIOContexts, 06 nov 2007

Originally committed as revision 11071 to svn://

700b9711 03/02/2007 09:47 PM Måns Rullgård

write DTS, based on patch by Luca Abeni, lucabe72 email it

Originally committed as revision 8196 to svn://

7fbde343 10/23/2006 08:57 AM Aurelien Jacobs

replace coder/decoder file description in libavformat by muxer/demuxer

Originally committed as revision 6774 to svn://

b78e7197 10/07/2006 03:30 PM Diego Biurrun

Change license headers to say 'FFmpeg' instead of 'this program/this library'
and fix GPL/LGPL version mismatches.

Originally committed as revision 6577 to svn://

ff70e601 07/10/2006 09:14 PM Måns Rullgård

allow individual selection of muxers and demuxers

Originally committed as revision 5707 to svn://

d2a067d1 07/09/2006 11:40 PM Måns Rullgård

give AVInput/OutputFormat structs consistent names

Originally committed as revision 5697 to svn://

7b49ce2e 06/18/2006 11:33 AM Stefan Huehner

Add const to (mostly) char* and make some functions static, which aren't used
outside their declaring source file and which have no corresponding prototype.
patch by Stefan Huehner stefan^^@^^huehner^^.^^org

Originally committed as revision 5497 to svn://

43a80cce 03/06/2006 02:13 PM Michael Niedermayer

generic crc calculation code

Originally committed as revision 5115 to svn://

6d276a9e 01/19/2006 10:30 PM Gildas Bazin

Properly #ifdef muxer-specific parts.
Taken from a patch by Gildas Bazin < gbazin -- @@ -- altern -- . -- org >

Originally committed as revision 4869 to svn://

5509bffa 01/12/2006 10:43 PM Diego Biurrun

Update licensing information: The FSF changed postal address.

Originally committed as revision 4842 to svn://

bb270c08 12/22/2005 01:10 AM Diego Biurrun

COSMETICS: tabs --> spaces, some prettyprinting

Originally committed as revision 4764 to svn://

115329f1 12/17/2005 06:14 PM Diego Biurrun

COSMETICS: Remove all trailing whitespace.

Originally committed as revision 4749 to svn://

01f4895c 07/17/2005 10:24 PM Michael Niedermayer

changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility

Originally committed as revision 4453 to svn://

8b475508 06/03/2005 02:05 PM Fabrice Bellard

buggy PCR output (just to keep HW decoders happy) - audio and subtitle language support - 'title' stream field sets the service name - fixed TS packet stuffing code - support for subtitle PES packets

Originally committed as revision 4349 to svn://

0044a8f8 03/09/2005 02:12 AM Måns Rullgård

double free patch by (Måns Rullgård <mru inprovide com>)
"This free is handled in av_write_trailer() since Oct 1 2004, but apparently mpegts was missed at the time."

Originally committed as revision 4023 to svn://

e928649b 05/29/2004 02:06 AM Michael Niedermayer

pass AVPacket into av_write_frame()
fixes the random dts/pts during encoding
asf preroll fix
no more initial zero frames for b frame encoding
mpeg-es dts during demuxing fixed
.ffm timestamp scale fixed, ffm is still broken though

Originally committed as revision 3168 to svn://

278de475 11/12/2003 09:56 PM Måns Rullgård

support more codecs in MPEG-TS patch by (mru at kth dot se (Måns Rullgård))

Originally committed as revision 2511 to svn://

69ef9450 09/16/2003 12:56 PM Fabrice Bellard

generate correct PTS in transport stream - use mpeg2 encoder by default

Originally committed as revision 2282 to svn://

49057904 09/10/2003 10:37 PM Fabrice Bellard

64 bit pts for writing - more const usage

Originally committed as revision 2255 to svn://

ce34182d 06/28/2003 11:44 PM Michael Niedermayer

try to filter all PATs if no SDT could be found patch by (<gbazin at altern dot org>)
+ mpegtsenc.c compile fix by me

Originally committed as revision 1995 to svn://