[patch] export pmt and pcr pids from mpegts demuxer
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids. The pid values are added to AVProgram.metadata inside the AVFormatContext. Example: key="pmt_pid" value="129" key="pcr_pid" value="1064" Values are base10. This patch supports multiple programs per transport stream. Feedback appreciated. -- Mike Scheutzow
On 6/6/10 10:11 AM, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
mpegts_export_psi_pids_v1.patch
Index: libavformat/mpegts.c =================================================================== --- libavformat/mpegts.c (revision 23373) +++ libavformat/mpegts.c (working copy) @@ -863,6 +863,8 @@ int comp_page, anc_page; char language[4]; uint32_t prog_reg_desc = 0; /* registration descriptor */ + AVProgram *program; + char pcr_str[8];
#ifdef DEBUG dprintf(ts->stream, "PMT: len %i\n", section_len); @@ -880,12 +882,23 @@ if (h->tid != PMT_TID) return;
+ /* returns existing if previously created */ + program = av_new_program(ts->stream, h->id); + if (!program) + return; + clear_program(ts, h->id); pcr_pid = get16(&p, p_end)& 0x1fff; - if (pcr_pid< 0) + if (pcr_pid< 0) { + /* delete key if present */ + av_metadata_set2(&program->metadata, "pcr_pid", NULL, 0); return; + } add_pid_to_pmt(ts, h->id, pcr_pid);
+ snprintf(pcr_str, sizeof(pcr_str), "%d", pcr_pid); + av_metadata_set2(&program->metadata, "pcr_pid", pcr_str, 0); +
Note to Michael: Why did deprecate av_metadata_set already ? Having this useless 0 at the end is ulgy. Patch looks good to me. [...] -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
On Sun, Jun 06, 2010 at 01:36:10PM -0700, Baptiste Coudurier wrote:
On 6/6/10 10:11 AM, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
mpegts_export_psi_pids_v1.patch
Index: libavformat/mpegts.c =================================================================== --- libavformat/mpegts.c (revision 23373) +++ libavformat/mpegts.c (working copy) @@ -863,6 +863,8 @@ int comp_page, anc_page; char language[4]; uint32_t prog_reg_desc = 0; /* registration descriptor */ + AVProgram *program; + char pcr_str[8];
#ifdef DEBUG dprintf(ts->stream, "PMT: len %i\n", section_len); @@ -880,12 +882,23 @@ if (h->tid != PMT_TID) return;
+ /* returns existing if previously created */ + program = av_new_program(ts->stream, h->id); + if (!program) + return; + clear_program(ts, h->id); pcr_pid = get16(&p, p_end)& 0x1fff; - if (pcr_pid< 0) + if (pcr_pid< 0) { + /* delete key if present */ + av_metadata_set2(&program->metadata, "pcr_pid", NULL, 0); return; + } add_pid_to_pmt(ts, h->id, pcr_pid);
+ snprintf(pcr_str, sizeof(pcr_str), "%d", pcr_pid); + av_metadata_set2(&program->metadata, "pcr_pid", pcr_str, 0); +
Note to Michael: Why did deprecate av_metadata_set already ? Having this useless 0 at the end is ulgy.
if C vararg functions passed the number of arguments we could support default values for the last N arguments to functions. but as they dont IIRC i dont know how defaults could be done in C. iam not sure if we want to have duplicate functions that have rarely used arguments set to defaults, iam not opposed to this but we should do this consistently with all functions where it makes sense and we should do it in a consistent and easy to understand way if we do it at all. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates
On Sun, Jun 06, 2010 at 01:11:35PM -0400, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
this feels like a misuse of the metadata API [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates
On 06/07/2010 07:08 PM, Michael Niedermayer wrote:
On Sun, Jun 06, 2010 at 01:11:35PM -0400, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
this feels like a misuse of the metadata API
Well, I don't agree, poluting AVStream with this format specific values seems really ugly to me. -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
On Mon, Jun 07, 2010 at 07:21:09PM -0700, Baptiste Coudurier wrote:
On 06/07/2010 07:08 PM, Michael Niedermayer wrote:
On Sun, Jun 06, 2010 at 01:11:35PM -0400, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
this feels like a misuse of the metadata API
Well, I don't agree, poluting AVStream with this format specific values seems really ugly to me.
iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure. Puttiing them in metadata though means they will be copied into the output files metadata too. ( like a .mkv or .mov) and further copying to mpg in a second step might then even create actual problems if the muxer does something with these tags. also as we are alraedy speaking of this, SCR/PCR arent exported currently and they should as they are needed for clock synchronization of the user application for actual stream where the user application is not in control of the incomming data rate. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
On 06/10/2010 03:18 PM, Michael Niedermayer wrote:
On Mon, Jun 07, 2010 at 07:21:09PM -0700, Baptiste Coudurier wrote:
On 06/07/2010 07:08 PM, Michael Niedermayer wrote:
On Sun, Jun 06, 2010 at 01:11:35PM -0400, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
this feels like a misuse of the metadata API
Well, I don't agree, poluting AVStream with this format specific values seems really ugly to me.
[...]
Puttiing them in metadata though means they will be copied into the output files metadata too. ( like a .mkv or .mov) and further copying to mpg in a second step might then even create actual problems if the muxer does something with these tags.
This is a problem that was introduced intentionally, IMHO we shouldn't blindly copy all metadata. [...] -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
On Thu, Jun 10, 2010 at 03:30:00PM -0700, Baptiste Coudurier wrote:
On 06/10/2010 03:18 PM, Michael Niedermayer wrote:
On Mon, Jun 07, 2010 at 07:21:09PM -0700, Baptiste Coudurier wrote:
On 06/07/2010 07:08 PM, Michael Niedermayer wrote:
On Sun, Jun 06, 2010 at 01:11:35PM -0400, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
this feels like a misuse of the metadata API
Well, I don't agree, poluting AVStream with this format specific values seems really ugly to me.
[...]
Puttiing them in metadata though means they will be copied into the output files metadata too. ( like a .mkv or .mov) and further copying to mpg in a second step might then even create actual problems if the muxer does something with these tags.
This is a problem that was introduced intentionally, IMHO we shouldn't blindly copy all metadata.
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid & pmt_pid is not data describing the video/audio its data describing the mpeg stream [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time.
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
On Thu, Jun 10, 2010 at 03:30:00PM -0700, Baptiste Coudurier wrote:
On 06/10/2010 03:18 PM, Michael Niedermayer wrote:
On Mon, Jun 07, 2010 at 07:21:09PM -0700, Baptiste Coudurier wrote:
On 06/07/2010 07:08 PM, Michael Niedermayer wrote:
On Sun, Jun 06, 2010 at 01:11:35PM -0400, Mike Scheutzow wrote:
This patch allows a libav application to obtain the pmt pid(s) and pcr pid(s) values parsed by the mpegts demuxer. This is useful for applications that need the output stream pids to match the input stream pids.
The pid values are added to AVProgram.metadata inside the AVFormatContext.
Example: key="pmt_pid" value="129" key="pcr_pid" value="1064"
Values are base10. This patch supports multiple programs per transport stream.
Feedback appreciated.
this feels like a misuse of the metadata API
Well, I don't agree, poluting AVStream with this format specific values seems really ugly to me.
[...]
Puttiing them in metadata though means they will be copied into the output files metadata too. ( like a .mkv or .mov) and further copying to mpg in a second step might then even create actual problems if the muxer does something with these tags.
This is a problem that was introduced intentionally, IMHO we shouldn't blindly copy all metadata.
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid& pmt_pid is not data describing the video/audio its data describing the mpeg stream
It's the same as major brand from mp4. We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export. So what do you propose ? Another field which is not called metadata ? -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
Baptiste Coudurier wrote:
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid& pmt_pid is not data describing the video/audio its data describing the mpeg stream
It's the same as major brand from mp4.
We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export.
So what do you propose ? Another field which is not called metadata ? Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand. Please give me a hint about an implementation that you would find acceptable. -- Mike Scheutzow
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
Baptiste Coudurier wrote:
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid& pmt_pid is not data describing the video/audio its data describing the mpeg stream
It's the same as major brand from mp4.
We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export.
So what do you propose ? Another field which is not called metadata ? Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand.
Please give me a hint about an implementation that you would find acceptable.
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure." I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong.
Michael Niedermayer wrote:
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
Baptiste Coudurier wrote:
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid& pmt_pid is not data describing the video/audio its data describing the mpeg stream
It's the same as major brand from mp4.
We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export.
So what do you propose ? Another field which is not called metadata ?
Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand.
Please give me a hint about an implementation that you would find acceptable.
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure."
I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time
The scenerio is transcoding transport stream to transport stream. I need the output stream to keep the same pid values as the input. The FFmpeg library does not provide enough capability to accomplish this. So the first step is to make the input side pmt/pcr pid values visible to the application (i.e. this patch). The next step is to improve the mpegts muxer to use app-supplied values. I like the AVMetadata approach because it has the benefit that key=value pairs can be set from the command line for the rare instances where someone needs to do so. -- Mike Scheutzow
On Sun, Jun 20, 2010 at 08:41:11AM -0400, Mike Scheutzow wrote:
Michael Niedermayer wrote:
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
Baptiste Coudurier wrote:
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid& pmt_pid is not data describing the video/audio its data describing the mpeg stream
It's the same as major brand from mp4.
We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export.
So what do you propose ? Another field which is not called metadata ?
Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand.
Please give me a hint about an implementation that you would find acceptable.
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure."
I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time
The scenerio is transcoding transport stream to transport stream. I need the output stream to keep the same pid values as the input. The FFmpeg library does not provide enough capability to accomplish this. So the first step is to make the input side pmt/pcr pid values visible to the application (i.e. this patch). The next step is to improve the mpegts muxer to use app-supplied values.
I still have no idea what you want to do. As said i can surely check the mpeg spec and that will likely awnser it but from your description its not clear to me, as example if id tell you i want to transcode foo to foo and need to keep the bar values that also tells you nothing. so why do you need to keep these values? are we talking about a mpeg spec requirement that isnt met by ffmpeg? are we talking about a specific use case where specific values are needed? ffmpeg should just work transcoding fileX to fileY, what am i missing? i also should be able to do mpegts->avi->mpegts and no matter what api you would loose the extra values that way [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart then the original author, trying to rewrite it will not make it better.
On 6/20/10 12:34 PM, Michael Niedermayer wrote:
On Sun, Jun 20, 2010 at 08:41:11AM -0400, Mike Scheutzow wrote:
Michael Niedermayer wrote:
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
Baptiste Coudurier wrote:
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
metadata (that is data describing the video and audio content) can be copied blindly. The problem is that pcr_pid& pmt_pid is not data describing the video/audio its data describing the mpeg stream
It's the same as major brand from mp4.
We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export.
So what do you propose ? Another field which is not called metadata ?
Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand.
Please give me a hint about an implementation that you would find acceptable.
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure."
I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time
The scenerio is transcoding transport stream to transport stream. I need the output stream to keep the same pid values as the input. The FFmpeg library does not provide enough capability to accomplish this. So the first step is to make the input side pmt/pcr pid values visible to the application (i.e. this patch). The next step is to improve the mpegts muxer to use app-supplied values.
I still have no idea what you want to do. As said i can surely check the mpeg spec and that will likely awnser it but from your description its not clear to me, as example if id tell you i want to transcode foo to foo and need to keep the bar values that also tells you nothing. so why do you need to keep these values? are we talking about a mpeg spec requirement that isnt met by ffmpeg? are we talking about a specific use case where specific values are needed? ffmpeg should just work transcoding fileX to fileY, what am i missing? i also should be able to do mpegts->avi->mpegts and no matter what api you would loose the extra values that way
Michael, I'm not sure what you are trying to say here, but even myself I don't understand what you mean. Keep in mind that we export the mp4 branch type as well. I don't care if user wants to know the pmt pid or not, if it's useful for somebody and simple to export, then let's do it. If user wants to use the same pid in the output ts when transcoding, it's fine. Now, either you say ok to put that in AVFormatContext->metadata or you want to introduce a new field in AVFormatContext, using the AVMetadata type where I can put this information. -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
On Sun, Jun 20, 2010 at 01:24:54PM -0700, Baptiste Coudurier wrote:
On 6/20/10 12:34 PM, Michael Niedermayer wrote:
On Sun, Jun 20, 2010 at 08:41:11AM -0400, Mike Scheutzow wrote:
Michael Niedermayer wrote:
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
Baptiste Coudurier wrote:
On 06/10/2010 03:45 PM, Michael Niedermayer wrote:
> metadata (that is data describing the video and audio content) can be > copied > blindly. > The problem is that pcr_pid& pmt_pid is not data describing the > video/audio > its data describing the mpeg stream > It's the same as major brand from mp4.
We are turning around here. Polluting AVStream/AVFormatContext with this format specific information seems ugly to me. We are not going to add a field for every value we want to export.
So what do you propose ? Another field which is not called metadata ?
Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand.
Please give me a hint about an implementation that you would find acceptable.
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure."
I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time
The scenerio is transcoding transport stream to transport stream. I need the output stream to keep the same pid values as the input. The FFmpeg library does not provide enough capability to accomplish this. So the first step is to make the input side pmt/pcr pid values visible to the application (i.e. this patch). The next step is to improve the mpegts muxer to use app-supplied values.
I still have no idea what you want to do. As said i can surely check the mpeg spec and that will likely awnser it but from your description its not clear to me, as example if id tell you i want to transcode foo to foo and need to keep the bar values that also tells you nothing. so why do you need to keep these values? are we talking about a mpeg spec requirement that isnt met by ffmpeg? are we talking about a specific use case where specific values are needed? ffmpeg should just work transcoding fileX to fileY, what am i missing? i also should be able to do mpegts->avi->mpegts and no matter what api you would loose the extra values that way
Michael, I'm not sure what you are trying to say here, but even myself I don't understand what you mean.
Keep in mind that we export the mp4 branch type as well.
brand IIRC ;) and the brand specifies to which "sub-spec" of mpeg4 a file is compliant to that is each brand -> set of rules a file complies to there can be multiple brands if a file complies to multiple specs. So for example if it contains a h264 stream it contains the "avc1" brand indicating that it complies to the specific spec That is the way i understand it. I dont really mind if its exported as: "mp4/major_brand" "3gp2" "mp4/compatible_brand" "isom" "mp4/compatible_brand" "iso2" as long as no better way to export it, is available without the mp4/ though its ambigous if its normal metadata or file details
I don't care if user wants to know the pmt pid or not, if it's useful for somebody and simple to export, then let's do it.
yes but maybe .... if i better understand it, there would be a cleaner way than just exporting it like that I simply feel i understand this too poorly to make a decission for example highly format specific values in a stream can be made available through AVOptions on the private context. or if we have a seperate strea, internally in the mpeg ts demuxer that carries a table of some kind, why for example is that stream not exportet like audio and video streams? and pids why are they not in AVStream.id ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML.
On 6/20/10 2:48 PM, Michael Niedermayer wrote:
On Sun, Jun 20, 2010 at 01:24:54PM -0700, Baptiste Coudurier wrote:
On 6/20/10 12:34 PM, Michael Niedermayer wrote:
On Sun, Jun 20, 2010 at 08:41:11AM -0400, Mike Scheutzow wrote:
Michael Niedermayer wrote:
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
Baptiste Coudurier wrote:
> On 06/10/2010 03:45 PM, Michael Niedermayer wrote: > >> metadata (that is data describing the video and audio content) can be >> copied >> blindly. >> The problem is that pcr_pid& pmt_pid is not data describing the >> video/audio >> its data describing the mpeg stream >> > It's the same as major brand from mp4. > > We are turning around here. > Polluting AVStream/AVFormatContext with this format specific > information > seems ugly to me. We are not going to add a field for every value we > want to export. > > So what do you propose ? Another field which is not called metadata ? > Michael,
I agree with Baptiste that adding very format-specific fields to AVProgram or AVStream makes the API more difficult to understand.
Please give me a hint about an implementation that you would find acceptable.
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure."
I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time
The scenerio is transcoding transport stream to transport stream. I need the output stream to keep the same pid values as the input. The FFmpeg library does not provide enough capability to accomplish this. So the first step is to make the input side pmt/pcr pid values visible to the application (i.e. this patch). The next step is to improve the mpegts muxer to use app-supplied values.
I still have no idea what you want to do. As said i can surely check the mpeg spec and that will likely awnser it but from your description its not clear to me, as example if id tell you i want to transcode foo to foo and need to keep the bar values that also tells you nothing. so why do you need to keep these values? are we talking about a mpeg spec requirement that isnt met by ffmpeg? are we talking about a specific use case where specific values are needed? ffmpeg should just work transcoding fileX to fileY, what am i missing? i also should be able to do mpegts->avi->mpegts and no matter what api you would loose the extra values that way
Michael, I'm not sure what you are trying to say here, but even myself I don't understand what you mean.
Keep in mind that we export the mp4 branch type as well.
brand IIRC ;) and the brand specifies to which "sub-spec" of mpeg4 a file is compliant to that is each brand -> set of rules a file complies to there can be multiple brands if a file complies to multiple specs. So for example if it contains a h264 stream it contains the "avc1" brand indicating that it complies to the specific spec That is the way i understand it.
I dont really mind if its exported as: "mp4/major_brand" "3gp2" "mp4/compatible_brand" "isom" "mp4/compatible_brand" "iso2" as long as no better way to export it, is available without the mp4/ though its ambigous if its normal metadata or file details
I don't care if user wants to know the pmt pid or not, if it's useful for somebody and simple to export, then let's do it.
yes but maybe .... if i better understand it, there would be a cleaner way than just exporting it like that
I simply feel i understand this too poorly to make a decission for example highly format specific values in a stream can be made available through AVOptions on the private context.
Metadata API is way simpler from the user point of view.
or if we have a seperate strea, internally in the mpeg ts demuxer that carries a table of some kind, why for example is that stream not exportet like audio and video streams? and pids why are they not in AVStream.id ?
pids are in AVStream.id for exported streams. PMT stream contains Section data which is MPEGTS specific, exporting all data tracks seems really overkill and furthermore it would be hard to distinguish which one is the PMT stream. -- Baptiste COUDURIER Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org
On Sun, Jun 20, 2010 at 04:11:24PM -0700, Baptiste Coudurier wrote:
On 6/20/10 2:48 PM, Michael Niedermayer wrote:
On Sun, Jun 20, 2010 at 01:24:54PM -0700, Baptiste Coudurier wrote:
On 6/20/10 12:34 PM, Michael Niedermayer wrote:
On Sun, Jun 20, 2010 at 08:41:11AM -0400, Mike Scheutzow wrote:
Michael Niedermayer wrote:
On Sat, Jun 19, 2010 at 09:35:41AM -0400, Mike Scheutzow wrote:
> Baptiste Coudurier wrote: > >> On 06/10/2010 03:45 PM, Michael Niedermayer wrote: >> >>> metadata (that is data describing the video and audio content) can >>> be >>> copied >>> blindly. >>> The problem is that pcr_pid& pmt_pid is not data describing the >>> video/audio >>> its data describing the mpeg stream >>> >> It's the same as major brand from mp4. >> >> We are turning around here. >> Polluting AVStream/AVFormatContext with this format specific >> information >> seems ugly to me. We are not going to add a field for every value we >> want to export. >> >> So what do you propose ? Another field which is not called metadata >> ? >> > Michael, > > I agree with Baptiste that adding very format-specific fields to > AVProgram or AVStream makes the API more difficult to understand. > > Please give me a hint about an implementation that you would find > acceptable. >
Please elaborate on how and for what they would be used: "iam not saying to put them in AVStream, actually iam not sure myself where to put them, maybe you can elaborate a bit on the use cases of these fields? Extending AVOptions to allow accessing demuxer specific contexts might be an option maybe but then maybe not iam not sure."
I cant make a suggestion if i dont know exactly what these fields would be used for. I can read the mpeg spec but that will take time
The scenerio is transcoding transport stream to transport stream. I need the output stream to keep the same pid values as the input. The FFmpeg library does not provide enough capability to accomplish this. So the first step is to make the input side pmt/pcr pid values visible to the application (i.e. this patch). The next step is to improve the mpegts muxer to use app-supplied values.
I still have no idea what you want to do. As said i can surely check the mpeg spec and that will likely awnser it but from your description its not clear to me, as example if id tell you i want to transcode foo to foo and need to keep the bar values that also tells you nothing. so why do you need to keep these values? are we talking about a mpeg spec requirement that isnt met by ffmpeg? are we talking about a specific use case where specific values are needed? ffmpeg should just work transcoding fileX to fileY, what am i missing? i also should be able to do mpegts->avi->mpegts and no matter what api you would loose the extra values that way
Michael, I'm not sure what you are trying to say here, but even myself I don't understand what you mean.
Keep in mind that we export the mp4 branch type as well.
brand IIRC ;) and the brand specifies to which "sub-spec" of mpeg4 a file is compliant to that is each brand -> set of rules a file complies to there can be multiple brands if a file complies to multiple specs. So for example if it contains a h264 stream it contains the "avc1" brand indicating that it complies to the specific spec That is the way i understand it.
I dont really mind if its exported as: "mp4/major_brand" "3gp2" "mp4/compatible_brand" "isom" "mp4/compatible_brand" "iso2" as long as no better way to export it, is available without the mp4/ though its ambigous if its normal metadata or file details
I don't care if user wants to know the pmt pid or not, if it's useful for somebody and simple to export, then let's do it.
yes but maybe .... if i better understand it, there would be a cleaner way than just exporting it like that
I simply feel i understand this too poorly to make a decission for example highly format specific values in a stream can be made available through AVOptions on the private context.
Metadata API is way simpler from the user point of view.
or if we have a seperate strea, internally in the mpeg ts demuxer that carries a table of some kind, why for example is that stream not exportet like audio and video streams? and pids why are they not in AVStream.id ?
pids are in AVStream.id for exported streams. PMT stream contains Section data which is MPEGTS specific, exporting all data tracks seems really overkill and furthermore it would be hard to distinguish which one is the PMT stream.
CODEC_ID_PMT anyway if you still think metadata is the right spot, i dont mind though i dont think it is the semantically correct place. And i think it will cause problems like when copying metadata. Even if metadata isnt copied by default, a user can choose to copy it and then pmt_pid will be copied to and that wont make any sense in the destination format [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope
participants (3)
-
baptiste.coudurier@gmail.com -
michaelni@gmx.at -
mjs973@optonline.net