Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
33018907
Commit
33018907
authored
Jan 14, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp3enc: allow omitting the id3v2 header with -id3v2_version 0
parent
f9cc6883
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
9 deletions
+33
-9
muxers.texi
doc/muxers.texi
+9
-2
mp3enc.c
libavformat/mp3enc.c
+23
-6
version.h
libavformat/version.h
+1
-1
No files found.
doc/muxers.texi
View file @
33018907
...
@@ -434,8 +434,10 @@ avconv -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
...
@@ -434,8 +434,10 @@ avconv -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
The MP3 muxer writes a raw MP3 stream with an ID3v2 header at the beginning and
The MP3 muxer writes a raw MP3 stream with an ID3v2 header at the beginning and
optionally an ID3v1 tag at the end. ID3v2.3 and ID3v2.4 are supported, the
optionally an ID3v1 tag at the end. ID3v2.3 and ID3v2.4 are supported, the
@code{id3v2_version} option controls which one is used. The legacy ID3v1 tag is
@code{id3v2_version} option controls which one is used. Setting
not written by default, but may be enabled with the @code{write_id3v1} option.
@code{id3v2_version} to 0 will disable the ID3v2 header completely. The legacy
ID3v1 tag is not written by default, but may be enabled with the
@code{write_id3v1} option.
The muxer may also write a Xing frame at the beginning, which contains the
The muxer may also write a Xing frame at the beginning, which contains the
number of frames in the file. It is useful for computing duration of VBR files.
number of frames in the file. It is useful for computing duration of VBR files.
...
@@ -466,6 +468,11 @@ avconv -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover"
...
@@ -466,6 +468,11 @@ avconv -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover"
-metadata:s:v comment="Cover (Front)" out.mp3
-metadata:s:v comment="Cover (Front)" out.mp3
@end example
@end example
Write a "clean" MP3 without any extra features:
@example
avconv -i input.wav -write_xing 0 -id3v2_version 0 out.mp3
@end example
@section ogg
@section ogg
Ogg container muxer.
Ogg container muxer.
...
...
libavformat/mp3enc.c
View file @
33018907
...
@@ -319,7 +319,7 @@ AVOutputFormat ff_mp2_muxer = {
...
@@ -319,7 +319,7 @@ AVOutputFormat ff_mp2_muxer = {
static
const
AVOption
options
[]
=
{
static
const
AVOption
options
[]
=
{
{
"id3v2_version"
,
"Select ID3v2 version to write. Currently 3 and 4 are supported."
,
{
"id3v2_version"
,
"Select ID3v2 version to write. Currently 3 and 4 are supported."
,
offsetof
(
MP3Context
,
id3v2_version
),
AV_OPT_TYPE_INT
,
{.
i64
=
4
},
3
,
4
,
AV_OPT_FLAG_ENCODING_PARAM
},
offsetof
(
MP3Context
,
id3v2_version
),
AV_OPT_TYPE_INT
,
{.
i64
=
4
},
0
,
4
,
AV_OPT_FLAG_ENCODING_PARAM
},
{
"write_id3v1"
,
"Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software."
,
{
"write_id3v1"
,
"Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software."
,
offsetof
(
MP3Context
,
write_id3v1
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
AV_OPT_FLAG_ENCODING_PARAM
},
offsetof
(
MP3Context
,
write_id3v1
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
AV_OPT_FLAG_ENCODING_PARAM
},
{
"write_xing"
,
"Write the Xing header containing file duration."
,
{
"write_xing"
,
"Write the Xing header containing file duration."
,
...
@@ -392,6 +392,14 @@ static int mp3_write_header(struct AVFormatContext *s)
...
@@ -392,6 +392,14 @@ static int mp3_write_header(struct AVFormatContext *s)
MP3Context
*
mp3
=
s
->
priv_data
;
MP3Context
*
mp3
=
s
->
priv_data
;
int
ret
,
i
;
int
ret
,
i
;
if
(
mp3
->
id3v2_version
&&
mp3
->
id3v2_version
!=
3
&&
mp3
->
id3v2_version
!=
4
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid ID3v2 version requested: %d. Only "
"3, 4 or 0 (disabled) are allowed.
\n
"
,
mp3
->
id3v2_version
);
return
AVERROR
(
EINVAL
);
}
/* check the streams -- we want exactly one audio and arbitrary number of
/* check the streams -- we want exactly one audio and arbitrary number of
* video (attached pictures) */
* video (attached pictures) */
mp3
->
audio_stream_idx
=
-
1
;
mp3
->
audio_stream_idx
=
-
1
;
...
@@ -415,13 +423,22 @@ static int mp3_write_header(struct AVFormatContext *s)
...
@@ -415,13 +423,22 @@ static int mp3_write_header(struct AVFormatContext *s)
}
}
mp3
->
pics_to_write
=
s
->
nb_streams
-
1
;
mp3
->
pics_to_write
=
s
->
nb_streams
-
1
;
ff_id3v2_start
(
&
mp3
->
id3
,
s
->
pb
,
mp3
->
id3v2_version
,
ID3v2_DEFAULT_MAGIC
);
if
(
mp3
->
pics_to_write
&&
!
mp3
->
id3v2_version
)
{
ret
=
ff_id3v2_write_metadata
(
s
,
&
mp3
->
id3
);
av_log
(
s
,
AV_LOG_ERROR
,
"Attached pictures were requested, but the "
if
(
ret
<
0
)
"ID3v2 header is disabled.
\n
"
);
return
ret
;
return
AVERROR
(
EINVAL
);
}
if
(
mp3
->
id3v2_version
)
{
ff_id3v2_start
(
&
mp3
->
id3
,
s
->
pb
,
mp3
->
id3v2_version
,
ID3v2_DEFAULT_MAGIC
);
ret
=
ff_id3v2_write_metadata
(
s
,
&
mp3
->
id3
);
if
(
ret
<
0
)
return
ret
;
}
if
(
!
mp3
->
pics_to_write
)
{
if
(
!
mp3
->
pics_to_write
)
{
ff_id3v2_finish
(
&
mp3
->
id3
,
s
->
pb
);
if
(
mp3
->
id3v2_version
)
ff_id3v2_finish
(
&
mp3
->
id3
,
s
->
pb
);
mp3_write_xing
(
s
);
mp3_write_xing
(
s
);
}
}
...
...
libavformat/version.h
View file @
33018907
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MINOR 10
#define LIBAVFORMAT_VERSION_MINOR 10
#define LIBAVFORMAT_VERSION_MICRO
2
#define LIBAVFORMAT_VERSION_MICRO
3
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
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