ffmpeg的迷惑警告 [warning]stream 0, timescale not set融虽,ffmpeg日志等級的設(shè)置

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 tbcI 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.pngOf 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.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末犀农,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子宰掉,更是在濱河造成了極大的恐慌呵哨,老刑警劉巖,帶你破解...
    沈念sama閱讀 211,639評論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件轨奄,死亡現(xiàn)場離奇詭異孟害,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)挪拟,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,277評論 3 385
  • 文/潘曉璐 我一進(jìn)店門挨务,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事谎柄」” “怎么了?”我有些...
    開封第一講書人閱讀 157,221評論 0 348
  • 文/不壞的土叔 我叫張陵谷誓,是天一觀的道長绒障。 經(jīng)常有香客問我,道長捍歪,這世上最難降的妖魔是什么户辱? 我笑而不...
    開封第一講書人閱讀 56,474評論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮糙臼,結(jié)果婚禮上庐镐,老公的妹妹穿的比我還像新娘。我一直安慰自己变逃,他們只是感情好必逆,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,570評論 6 386
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著揽乱,像睡著了一般名眉。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上凰棉,一...
    開封第一講書人閱讀 49,816評論 1 290
  • 那天损拢,我揣著相機(jī)與錄音,去河邊找鬼撒犀。 笑死福压,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的或舞。 我是一名探鬼主播荆姆,決...
    沈念sama閱讀 38,957評論 3 408
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼映凳!你這毒婦竟也來了胆筒?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,718評論 0 266
  • 序言:老撾萬榮一對情侶失蹤魏宽,失蹤者是張志新(化名)和其女友劉穎腐泻,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體队询,經(jīng)...
    沈念sama閱讀 44,176評論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡派桩,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,511評論 2 327
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了蚌斩。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片铆惑。...
    茶點(diǎn)故事閱讀 38,646評論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出员魏,到底是詐尸還是另有隱情丑蛤,我是刑警寧澤,帶...
    沈念sama閱讀 34,322評論 4 330
  • 正文 年R本政府宣布撕阎,位于F島的核電站受裹,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏虏束。R本人自食惡果不足惜棉饶,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,934評論 3 313
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望镇匀。 院中可真熱鬧照藻,春花似錦、人聲如沸汗侵。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,755評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽晰韵。三九已至发乔,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間宫屠,已是汗流浹背列疗。 一陣腳步聲響...
    開封第一講書人閱讀 31,987評論 1 266
  • 我被黑心中介騙來泰國打工滑蚯, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留浪蹂,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 46,358評論 2 360
  • 正文 我出身青樓告材,卻偏偏與公主長得像坤次,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子斥赋,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,514評論 2 348

推薦閱讀更多精彩內(nèi)容