Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
481a3667
Commit
481a3667
authored
Aug 12, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmdutils: allow matching by metadata in stream specifiers
parent
8ddc3262
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
0 deletions
+36
-0
Changelog
Changelog
+1
-0
cmdutils.c
cmdutils.c
+23
-0
avconv.texi
doc/avconv.texi
+5
-0
avtools-common-opts.texi
doc/avtools-common-opts.texi
+7
-0
No files found.
Changelog
View file @
481a3667
...
...
@@ -30,6 +30,7 @@ version <next>:
- drop avserver, it was unmaintained for years and largely broken
- Icecast protocol
- request icecast metadata by default
- support for using metadata in stream specifiers in avtools
version 10:
...
...
cmdutils.c
View file @
481a3667
...
...
@@ -1536,6 +1536,29 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
spec
+=
2
;
stream_id
=
strtol
(
spec
,
&
endptr
,
0
);
return
stream_id
==
st
->
id
;
}
else
if
(
*
spec
==
'm'
&&
*
(
spec
+
1
)
==
':'
)
{
AVDictionaryEntry
*
tag
;
char
*
key
,
*
val
;
int
ret
;
spec
+=
2
;
val
=
strchr
(
spec
,
':'
);
key
=
val
?
av_strndup
(
spec
,
val
-
spec
)
:
av_strdup
(
spec
);
if
(
!
key
)
return
AVERROR
(
ENOMEM
);
tag
=
av_dict_get
(
st
->
metadata
,
key
,
NULL
,
0
);
if
(
tag
)
{
if
(
!
val
||
!
strcmp
(
tag
->
value
,
val
+
1
))
ret
=
1
;
else
ret
=
0
;
}
else
ret
=
0
;
av_freep
(
&
key
);
return
ret
;
}
else
if
(
!*
spec
)
/* empty specifier, matches everything */
return
1
;
...
...
doc/avconv.texi
View file @
481a3667
...
...
@@ -720,6 +720,11 @@ To map all the streams except the second audio, use negative mappings
avconv -i INPUT -map 0 -map -0:a:1 OUTPUT
@end example
To pick the English audio stream:
@example
avconv -i INPUT -map 0:m:language:eng OUTPUT
@end example
Note that using this option disables the default mappings for this output file.
@item -map
_
metadata[:@var
{
metadata
_
spec
_
out
}
] @var
{
infile
}
[:@var
{
metadata
_
spec
_
in
}
] (@emph
{
output,per-metadata
}
)
...
...
doc/avtools-common-opts.texi
View file @
481a3667
...
...
@@ -44,6 +44,13 @@ If @var{stream_index} is given, then matches stream number @var{stream_index} in
program with id @var{program_id}. Otherwise matches all streams in this program.
@item i:@var{stream_id}
Match the stream by stream id (e.g. PID in MPEG-TS container).
@item m:@var{key}[:@var{value}]
Matches streams with the metadata tag @var{key} having the specified value. If
@var{value} is not given, matches streams that contain the given tag with any
value.
Note that in @command{avconv}, matching by metadata will only work properly for
input files.
@end table
@section Generic options
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment