ffmpeg的迷惑警告 [warning]stream 0, t

2020-02-17  本文已影响0人  mudssky

ffmpeg的迷惑警告 [warning]stream 0, timescale not set,ffmpeg日志等级的设置

​ 写完转换视频为带封面的音频的脚本的时候,发现生成的音频用ffmpeg导入的时候都会出现这个警告。

​ 也就是说ffmpeg在导入带有封面的m4a文件的时候都会有这个警告

​ 网上搜索了一圈发现也没有相关的问题,毕竟很多程序员都是能运行就行了,warning级别的都不会去管的,只要不crash都无所谓。实际上这个警告也确实不影响播放,目前我已知只有ffmpeg会有这个警告,ffplay也能正常播放,并且用mp3tag之类打开也没看出什么问题。

​ 首先这个警告的意思,timescale,翻译是一段时间,时间尺度,估计是指起始时间和结束时间。然后我去官方文档去搜,也没找到关于timescale 相关的描述。

​ 先来了解一下ffmpeg loglevel选项相关的使用。因为发现这个警告输出,网上找不到答案,所以就想从ffmpeg的日志输出中发现问题,输出的日志内容能不能更多一点。

​ 官方文档的说明就放在下面作为参考

​ 使用方式是这样 -loglevel level+repeat+verbose

​ level和repeat属于flag,verbose属于日志等级。

​ level就是在输出前面加上日志等级,比如[info]

​ reapeat估计是把输出的相同的日志用出现几次代替。

​ 最高的日志等级是trace,读取每一帧的信息的时候都会打印日志。

​ 其次是debug,可见,我们平时使用的最详细的输出就是debug

​ 然后因为默认情况下日志输出的信息已经很多了,所以还是消去日志输出的选项会更通用。只要level设置为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:

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:

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.

最后我发现这个错误信息可能是ffmpeg的bug,对于使用者没有什么帮助的提示信息。

首先是在网上找到了相关的问题,然后我自己试了发现这个问题只要是m4a文件都有,就算是用mp3tag编辑的文件也有这个警告提示。只要加了封面。然后用ffmpeg把封面去掉,再导入就没有这个警告了。

所以说应该问题不大。

这个问题出现在tageditor作者github的issue里,它认为这是ffmpeg给出的误导性的错误提示。

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.

上一篇下一篇

猜你喜欢

热点阅读