[FFmpeg-user] split audio/video and merge later gets async

Frank Tetzel s1445051 at mail.zih.tu-dresden.de
Mon Sep 2 15:41:08 CEST 2013


> > Even if i don't process the audio file (except convert to wav). 
> > Just splitting and merging gets out of sync.
> > $ ffmpeg -i grab.mkv -vn -c:a pcm_s16le grab-aud.wav
> > $ ffmpeg -i grab.mkv -i grab-aud.wav -map 0:0 -map 1:0 -c copy
> > merge.mkv
> 
> Complete, uncut console output missing.

See end of message.

> Audio in mkv probably has a delay which cannot be saved in wav, 
> I don't think anything except finding out the delay and using 
> it when remuxing (itsoffset) is possible.

The delay isn't constant. The gap seems to get bigger over time, audio
before video.

Besides, how do i find out the delay? ffprobe (-show_streams) doesn't
help me here (see end of message).

> Which audio filter is missing in FFmpeg?

A filter for noise reduction would be handy. sox noisered does a good
job, similar to audacity.

Regards,
Frank.


(I rebuilt ffmpeg recently to enable libfdk-aac and libaacplus. The
recording was done without it. The problem was already there.)

$ ffmpeg -i grab.mkv -vn -c:a pcm_s16le grab-aud.wav
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep  1 2013 19:33:37 with gcc 4.8.1 (GCC) 20130725 (prerelease)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab --enable-libaacplus --enable-libfdk-aac --enable-nonfree
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from 'grab.mkv':
  Metadata:
    ENCODER         : Lavf55.12.100
  Duration: 01:05:21.04, start: 0.000000, bitrate: 754 kb/s
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 798x438, SAR 1:1 DAR 133:73, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1: Audio: flac, 44100 Hz, mono, s16 (default)
Output #0, wav, to 'grab-aud.wav':
  Metadata:
    ISFT            : Lavf55.12.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s (default)
Stream mapping:
  Stream #0:1 -> #0:0 (flac -> pcm_s16le)
Press [q] to stop, [?] for help
size=  337437kB time=01:05:20.94 bitrate= 705.0kbits/s    
video:0kB audio:337437kB subtitle:0 global headers:0kB muxing overhead 0.000023%

$ ffmpeg -i grab.mkv -i grab-aud.wav -map 0:0,0:0 -map 1:0,0:0 -c copy merge.mkv
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep  1 2013 19:33:37 with gcc 4.8.1 (GCC) 20130725 (prerelease)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab --enable-libaacplus --enable-libfdk-aac --enable-nonfree
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from 'grab.mkv':
  Metadata:
    ENCODER         : Lavf55.12.100
  Duration: 01:05:21.04, start: 0.000000, bitrate: 754 kb/s
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 798x438, SAR 1:1 DAR 133:73, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1: Audio: flac, 44100 Hz, mono, s16 (default)
Guessed Channel Layout for  Input Stream #1.0 : mono
Input #1, wav, from 'grab-aud.wav':
  Metadata:
    encoder         : Lavf55.12.100
  Duration: 01:05:17.64, bitrate: 705 kb/s
    Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Output #0, matroska, to 'merge.mkv':
  Metadata:
    encoder         : Lavf55.12.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv444p, 798x438 [SAR 1:1 DAR 133:73], q=2-31, 25 fps, 1k tbn, 1k tbc (default)
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=98026 fps=52546 q=-1.0 Lsize=  508544kB time=01:05:21.00 bitrate=1062.5kbits/s    
video:169839kB audio:337437kB subtitle:0 global headers:0kB muxing overhead 0.249911%

$ ffprobe -show_streams grab.mkv 
ffprobe version 2.0.1 Copyright (c) 2007-2013 the FFmpeg developers
  built on Sep  1 2013 19:33:37 with gcc 4.8.1 (GCC) 20130725 (prerelease)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab --enable-libaacplus --enable-libfdk-aac --enable-nonfree
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from 'grab.mkv':
  Metadata:
    ENCODER         : Lavf55.12.100
  Duration: 01:05:21.04, start: 0.000000, bitrate: 754 kb/s
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 798x438, SAR 1:1 DAR 133:73, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1: Audio: flac, 44100 Hz, mono, s16 (default)
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High 4:4:4 Predictive
codec_type=video
codec_time_base=1/50
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=798
height=438
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=133:73
pix_fmt=yuv444p
level=30
timecode=N/A
id=N/A
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
[/STREAM]
[STREAM]
index=1
codec_name=flac
codec_long_name=FLAC (Free Lossless Audio Codec)
profile=unknown
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=s16
sample_rate=44100
channels=1
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
[/STREAM]


More information about the ffmpeg-user mailing list