題 新的FFMPEG; “[swscaler @ 0xa314080]警告:數據未對齊!這可能導致速度損失“


相關 ; 使用ffmpeg創建一個截屏視頻:如何保持視頻+音頻同步?

ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers

建立於2014年3月13日16:08:45與gcc 4.8(Ubuntu / Linaro 4.8.1-10ubuntu9)

產生錯誤

"[swscaler @ 0xa314080] Warning: data is not aligned! This can lead to a speedloss"

最終結果是嚴重的a / v同步問題,視頻就好像它處於快進狀態。

有誰遇到過這個問題?任何解決方案的想法?

目標是截屏;


    ffmpeg -f alsa -ac 2 -i hw:2,0 -f x11grab -r 30 -s 1920x1072 -i :0.0 -acodec libmp3lame -ab 320k -sameq /media/username/library-portable/video-studio/transfer-bin/BTSvlog02.avi
ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 13 2014 16:08:45 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --prefix=/home/username/ffmpeg_build --extra-cflags=-I/home/username/ffmpeg_build/include --extra-ldflags=-L/home/username/ffmpeg_build/lib --bindir=/home/username/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.101 / 55. 34.101
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Option 'sameq' was removed. If you are looking for an option to preserve the quality (which is not what -sameq was for), use -qscale 0 or an equivalent quality factor option.
Failed to set value '1' for option 'sameq': Invalid argument
Error parsing global options: Invalid argument 

曾經工作。

我試過了(只是再次嘗試); (新增/更新於2014年3月17日星期一


ffmpeg -f alsa -ac 2 -i hw:2,0 -f x11grab -r 30 -s 1920x1080 -i :0.0 -acodec libmp3lame -ab 320k /media/username/library-portable/video-studio/transfer-bin/BTSvlog03.avi
ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 13 2014 16:08:45 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --prefix=/home/username/ffmpeg_build --extra-cflags=-I/home/username/ffmpeg_build/include --extra-ldflags=-L/home/username/ffmpeg_build/lib --bindir=/home/username/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 66.101 / 52. 66.101
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 34.101 / 55. 34.101
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:2,0':
  Duration: N/A, start: 1395098882.312775, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[x11grab @ 0x9ea2c20] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1920 height: 1080
[x11grab @ 0x9ea2c20] shared memory extension found
Input #1, x11grab, from ':0.0':
  Duration: N/A, start: 1395098882.360550, bitrate: 1990656 kb/s
    Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 1990656 kb/s, 30 tbr, 1000k tbn, 30 tbc
Output #0, avi, to '/media/username/library-portable/video-studio/transfer-bin/BTSvlog03.avi':
  Metadata:
    ISFT            : Lavf55.34.101
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s, 30 tbn, 30 tbc
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 320 kb/s
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> mpeg4)
  Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
[swscaler @ 0x9e81080] Warning: data is not aligned! This can lead to a speedloss
[alsa @ 0x9e98d00] ALSA buffer xrun.743kB time=00:00:00.13 bitrate=45644.2kbits/s    
[alsa @ 0x9e98d00] ALSA buffer xrun.1067kB time=00:00:01.70 bitrate=5131.9kbits/s    
[alsa @ 0x9e98d00] ALSA buffer xrun.2175kB time=00:00:05.95 bitrate=2994.1kbits/s    
[alsa @ 0x9e98d00] ALSA buffer xrun.5550kB time=00:00:17.68 bitrate=2570.6kbits/s    
frame=  580 fps=9.9 q=31.0 Lsize=    6540kB time=00:00:50.28 bitrate=1065.5kbits/s    
video:6433kB audio:34kB subtitle:0 data:0 global headers:0kB muxing overhead 1.125390%
Received signal 2: terminating.
 

相同的結果;

*注意,FFMPEG問題很可能是Ubuntu問題。我在Kubuntu 13.10上。在FFMPEG社區中存在分歧,Ubuntu小組最終離開了FFMPEG項目。


7
2018-03-13 23:18


起源


放棄選項 -sameq 首先再試一次。 ffmpeg版本似乎是真實的,雖然我不能說任何庫是否衝突。但試著放棄 -sameq 第一。 - Rajib
評論不允許代碼,所以我更新了問題。基本上,結果相同。 - Syborgia Alphas
我合併多個視頻文件時收到此警告:( - gkd
我剛剛進入FFmpeg開發。我會告訴你發生了什麼。 - Syborgia Alphas


答案:


1080/16 = 67.5,這不是一個整數,可能導致將68個項目寫入具有67個插槽的緩衝區,可能會使編碼器崩潰。其他東西可能會達到68,逐漸偏離報告的已處理位數。

根據 這個帖子,違規代碼是:

420 if ( (uintptr_t)dst[0]%16 || (uintptr_t)dst[1]%16 || (uintptr_t)dst[2]%16
421 || (uintptr_t)src[0]%16 || (uintptr_t)src[1]%16 || (uintptr_t)src[2]%16
422 || dstStride[0]%16 || dstStride[1]%16 || dstStride[2]%16 || dstStride[3]%16
423 || srcStride[0]%16 || srcStride[1]%16 || srcStride[2]%16 || srcStride[3]%16
424 ) {
425 static int warnedAlready=0;
426 int cpu_flags = av_get_cpu_flags();
427 if (HAVE_MMXEXT && (cpu_flags & AV_CPU_FLAG_SSE2) && !warnedAlready){
428 av_log(c, AV_LOG_WARNING, "Warning: data is not aligned! This can lead to a speedloss\n");
429 warnedAlready=1;
430 }
431 } 

1080%16 = 8,代碼預期為0,因此大小應為16的倍數。


4
2017-08-19 12:30