ffmpeg的迷惑警告 [warning]stream 0, timescale not set,ffmpeg日志等級的設(shè)置
? 寫完轉(zhuǎn)換視頻為帶封面的音頻的腳本的時(shí)候舞终,發(fā)現(xiàn)生成的音頻用ffmpeg導(dǎo)入的時(shí)候都會出現(xiàn)這個(gè)警告。
? 也就是說ffmpeg在導(dǎo)入帶有封面的m4a文件的時(shí)候都會有這個(gè)警告
? 網(wǎng)上搜索了一圈發(fā)現(xiàn)也沒有相關(guān)的問題翎苫,畢竟很多程序員都是能運(yùn)行就行了权埠,warning級別的都不會去管的,只要不crash都無所謂煎谍。實(shí)際上這個(gè)警告也確實(shí)不影響播放攘蔽,目前我已知只有ffmpeg會有這個(gè)警告,ffplay也能正常播放呐粘,并且用mp3tag之類打開也沒看出什么問題满俗。
?
? 首先這個(gè)警告的意思,timescale作岖,翻譯是一段時(shí)間唆垃,時(shí)間尺度,估計(jì)是指起始時(shí)間和結(jié)束時(shí)間痘儡。然后我去官方文檔去搜辕万,也沒找到關(guān)于timescale 相關(guān)的描述。
?
? 先來了解一下ffmpeg loglevel選項(xiàng)相關(guān)的使用。因?yàn)榘l(fā)現(xiàn)這個(gè)警告輸出渐尿,網(wǎng)上找不到答案醉途,所以就想從ffmpeg的日志輸出中發(fā)現(xiàn)問題,輸出的日志內(nèi)容能不能更多一點(diǎn)砖茸。
? 官方文檔的說明就放在下面作為參考
? 使用方式是這樣 -loglevel level+repeat+verbose
? level和repeat屬于flag隘擎,verbose屬于日志等級。
? level就是在輸出前面加上日志等級凉夯,比如[info]
? reapeat估計(jì)是把輸出的相同的日志用出現(xiàn)幾次代替货葬。
? 最高的日志等級是trace,讀取每一幀的信息的時(shí)候都會打印日志劲够。
? 其次是debug震桶,可見,我們平時(shí)使用的最詳細(xì)的輸出就是debug
? 然后因?yàn)槟J(rèn)情況下日志輸出的信息已經(jīng)很多了再沧,所以還是消去日志輸出的選項(xiàng)會更通用尼夺。只要level設(shè)置為quiet就可以了
? -loglevel [flags+]loglevel | -v [flags+]loglevel
Set logging level and flags used by the library.
The optional flags prefix can consist of the following values:
-
‘repeat’
Indicates that repeated log output should not be compressed to the first line and the "Last message repeated n times" line will be omitted.
-
‘level’
Indicates that log output should add a
[level]
prefix to each message line. This can be used as an alternative to log coloring, e.g. when dumping the log to file.
Flags can also be used alone by adding a ’+’/’-’ prefix to set/reset a single flag without affecting other flags or changing loglevel. When setting both flags and loglevel, a ’+’ separator is expected between the last flags value and before loglevel.
loglevel is a string or a number containing one of the following values:
-
‘quiet, -8’
Show nothing at all; be silent.
-
‘panic, 0’
Only show fatal errors which could lead the process to crash, such as an assertion failure. This is not currently used for anything.
-
‘fatal, 8’
Only show fatal errors. These are errors after which the process absolutely cannot continue.
-
‘error, 16’
Show all errors, including ones which can be recovered from.
-
‘warning, 24’
Show all warnings and errors. Any message related to possibly incorrect or unexpected events will be shown.
-
‘info, 32’
Show informative messages during processing. This is in addition to warnings and errors. This is the default value.
-
‘verbose, 40’
Same as
info
, except more verbose. -
‘debug, 48’
Show everything, including debugging information.
‘trace, 56’
For example to enable repeated log output, add the level
prefix, and set loglevel to verbose
:
ffmpeg -loglevel repeat+level+verbose -i input output
Another example that enables repeated log output without affecting current state of level
prefix flag or loglevel:
ffmpeg [...] -loglevel +repeat
By default the program logs to stderr. If coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable AV_LOG_FORCE_NOCOLOR
, or can be forced setting the environment variable AV_LOG_FORCE_COLOR
.
最后我發(fā)現(xiàn)這個(gè)錯(cuò)誤信息可能是ffmpeg的bug尊残,對于使用者沒有什么幫助的提示信息炒瘸。
首先是在網(wǎng)上找到了相關(guān)的問題,然后我自己試了發(fā)現(xiàn)這個(gè)問題只要是m4a文件都有寝衫,就算是用mp3tag編輯的文件也有這個(gè)警告提示顷扩。只要加了封面。然后用ffmpeg把封面去掉慰毅,再導(dǎo)入就沒有這個(gè)警告了隘截。
所以說應(yīng)該問題不大。
這個(gè)問題出現(xiàn)在tageditor作者github的issue里汹胃,它認(rèn)為這是ffmpeg給出的誤導(dǎo)性的錯(cuò)誤提示婶芭。
https://github.com/Martchus/tageditor/issues/1
下面把issue貼過來,作為參考着饥。
fmpeg warning "stream 0, timescale not set" appears after adding cover art to. mp4/.m4a #1
Closed
ponsfoot opened this issue on 8 Oct 2016 · 3 comments
ponsfoot commented on 8 Oct 2016
Hi,
After adding cover art to .mp4/.m4a file, the following warning appears (when opening).
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55a51db589a0] stream 0, timescale not set
If not adding cover, this doesn't appear.
There seems to be no problem to play by this message, though :)
Version: 2.0.0
OS: ArchLinux (x86_64)
Packages from your binary repository
result of ffmpeg -i of the file before adding cover:
ffmpeg -i 01\ -\ Signs\ Of\ Spring.m4a.bak
ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.2.1 (GCC) 20160830
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-netcdf --enable-shared --enable-version3 --enable-x11grab
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01 - Signs Of Spring.m4a.bak':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: M4A mp42isom
creation_time : 2013-04-25 02:25:25
iTunSMPB : 00000000 00000A40 000003D8 0000000000B2D9E8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
track : 1
artist : UNCHAIN
album : rapture
date : 2008
genre : JPop
title : Signs Of Spring
encoder : Nero AAC codec / 1.5.4.0
Duration: 00:04:25.87, start: 0.059501, bitrate: 232 kb/s
Chapter #0:0: start 0.059501, end 265.927979
Metadata:
title :
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 230 kb/s (default)
Metadata:
creation_time : 2013-04-25 02:25:25
handler_name : Sound Media Handler
At least one output file must be specified
And after adding cover:
ffmpeg -i 01\ -\ Signs\ Of\ Spring.m4a
ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.2.1 (GCC) 20160830
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-netcdf --enable-shared --enable-version3 --enable-x11grab
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x564acd8939a0] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01 - Signs Of Spring.m4a':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: M4A mp42isom
creation_time : 2013-04-25 02:25:25
iTunSMPB : 00000000 00000A40 000003D8 0000000000B2D9E8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
track : 1
artist : UNCHAIN
album : rapture
date : 2008
genre : JPop
title : Signs Of Spring
encoder : Nero AAC codec / 1.5.4.0
Duration: 00:04:25.87, start: 0.059500, bitrate: 234 kb/s
Chapter #0:0: start 0.059501, end 265.927978
Metadata:
title :
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 230 kb/s (default)
Metadata:
creation_time : 2013-04-25 02:25:25
handler_name : Sound Media Handler
Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 500x500 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
At least one output file must be specified
Thank you for useful software and providing binary repo.
Best regards
Owner
Martchus commented on 8 Oct 2016 ? edited
Hi, I can reproduce the issue. However, I suspect that there's nothing wrong with the Tag Editor (or the tagparser library).If you look at the output where the warning occurs you'll notice that there's also an additional video stream detected. However, this stream is just the cover. I added a PNG cover and ffmpeg displays the following additional stream:Stream #0:1: Video: png, rgb24(pc), 1940x1048 [SAR 3779:3779 DAR 485:262], 90k tbr, 90k tbn, 90k tbc
I guess treating the cover as a stream is intended. It allows you to extract the cover again:ffmpeg -i test2.m4a -map 0:1 cover.png
Of course ffmpeg will not find any timescale information for the cover in the file and hence prints accidentally the warning.I also doubt that the timescale info for the actual audio track is missing becausethen the duration could not be calculated anymore but this is still the case.if you remove the cover again, the warning disappears again.the warning occurs when opening any MP4 file with cover (also files never touched by the Tag Editor).So looks more like a misleading ffmpeg warning to me.BTW: You might want to try libfdk_aac
. I switched from the Nero encoder some time ago and I'm satisfied with the results. My binary repo also contains the package ffmpeg-libfdk_aac
.Best Regards
Owner
Martchus commented on 8 Oct 2016
Seems that this is a known issue:https://lists.ffmpeg.org/pipermail/ffmpeg-user/2013-April/014470.htmlhttp://stackoverflow.com/questions/17798709/ffmpeg-how-to-embed-cover-art-image-to-m4a
ponsfoot commented on 9 Oct 2016
Okay, I understand. Thank you for the info and I'll try ffmpeg-libfdk_aac.