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

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

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 :

Another example that enables repeated log output without affecting current state of level prefix flag or loglevel:

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贴过来,作为参考。

Closed

ponsfoot opened this issue on 8 Oct 2016 · 3 comments

Hi,

After adding cover art to .mp4/.m4a file, the following warning appears (when opening).

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:

And after adding cover:

Thank you for useful software and providing binary repo.

Best regards

Owner

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

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

Okay, I understand. Thank you for the info and I'll try ffmpeg-libfdk_aac.

您好,异步日志是一种常用的日志记录方式,它将日志的写 *** 作异步化,即先将日志消息存储在内存缓冲区中,再在后台线程中将其写入磁盘。这种方式可以提高日志记录的性能和效率。

在异步日志中,通常会定义不同的日志级别,例如debug、info、warning、error等级别。这些级别用于区分不同类型的日志消息,便于开发人员快速定位问题。

对于异步日志先打印error级别,这是一种常见的做法。因为error级别的日志通常表示程序出现了严重的错误,需要及时处理。如果先打印error级别的日志,可以确保开发人员能够及时发现并处理这些错误,避免造成更大的损失。

另外,异步日志的特点是可以在后台线程中写入磁盘,因此即使出现大量的error级别日志,也不会对程序的性能和响应时间产生太大的影响。因此,先打印error级别的日志是一种比较安全和稳妥的做法,可以帮助开发人员更好地维护和管理程序。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/8095612.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-13
下一篇 2023-04-13

发表评论

登录后才能评论

评论列表(0条)

保存