Opened 8 years ago

Closed 8 years ago

#5498 closed defect (fixed)

Pentax K-r MJPEG files - one second clicking

Reported by: wanted Owned by:
Priority: important Component: avformat
Version: git-master Keywords: avi regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
Files produced by Pentax K-r camera are not fully supported by ffmpeg. There is an issue with audio, where one can hear a distinct click every second, both when using ffplay and in output files converted with ffmpeg. I read on some forum this might be related to the way audio from AVI files from this camera is interleaved with video, i.e. with 1 second period, which is unusual.

Many tools, like video converters, based on ffmpeg also exhibit this behavior. My workaround has always been to use avidemux, which works fine with those AVI files, but it would be nice to fix that also for ffmpeg.

How to reproduce:

% ffplay <file>

ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311
  configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv

Example file:
http://wanted.eu.org/pub/pentax_1sec_clicking.avi

mediainfo output on the example file, notice audio interleave of 1 second.

Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 24.3 MiB
Duration                                 : 8s 0ms
Overall bit rate                         : 25.5 Mbps
Mastered date                            : 2012/05/27 16:11:38
Writing application                      : PENTAX K-r                             

Video
ID                                       : 0
Format                                   : JPEG
Codec ID                                 : MJPG
Duration                                 : 8s 0ms
Bit rate                                 : 24.9 Mbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 1.082
Stream size                              : 23.8 MiB (98%)

Audio
ID                                       : 1
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : 1
Duration                                 : 8s 0ms
Bit rate mode                            : Constant
Bit rate                                 : 512 Kbps
Channel(s)                               : 1 channel
Sampling rate                            : 32.0 KHz
Bit depth                                : 16 bits
Stream size                              : 500 KiB (2%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 1000 ms (25.00 video frames)
Interleave, preload duration             : 1000 ms

Change History (2)

comment:1 by Carl Eugen Hoyos, 8 years ago

Component: undeterminedavformat
Keywords: avi regression added; pentax k-r interleave audio clicking removed
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

For future tickets: Please understand that Mediainfo output is never required, FFmpeg command line and complete, uncut console output is always required for valid tickets.

Regression since ef8cc06d6e50d3da7b781e126a3bce7929b53a55
Originally fixed in 8df774be88c347c40f1b2411ed9e391dfec0ebb7

$ ffmpeg -i pentax_1sec_clicking.avi -qscale 2 out.avi
ffmpeg version N-79713-gbc2fe36 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      55. 23.100 / 55. 23.100
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 35.100 / 57. 35.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, avi, from 'pentax_1sec_clicking.avi':
  Metadata:
    creation_time   : 2012-05-27 16:11:38
    encoder         : PENTAX K-r
  Duration: 00:00:08.00, start: 0.000000, bitrate: 25451 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 25058 kb/s, 25 fps, 25 tbr, 25 tbn
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, 1 channels, s16, 512 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
[swscaler @ 0x2b8cf60] deprecated pixel format used, make sure you did set range correctly
[avi @ 0x2b60980] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf57.35.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720, q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc57.38.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 32000 Hz, mono, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc57.38.100 ac3
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> ac3 (native))
Press [q] to stop, [?] for help
frame=  200 fps=118 q=2.0 Lsize=   27339kB time=00:00:08.01 bitrate=27939.2kbits/s speed=4.71x
video:27227kB audio:94kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.067268%

comment:2 by Michael Niedermayer, 8 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.