cannot seek backward

I am affected by http://www.kdenlive.org/mantis/view.php?id=1616 even after upgrading to kdenlive 0.7.8-0ubuntu0~sunab~lucid3 and 0.5.10-0ubuntu0~sunab~lucid1

Sadly, I cannot use kdenlive at all due to this severe bug.

Is there a workaround?

Forums:

I've seen similar trouble with huffyuv+ADPCM encoded AVI files: video keeps moving forwards, even though audio correctly seeks backwards. Transcoding to a different audio and/or video encoding seems to help, either using the built-in "transcode clips" utility or an external program, such as ffmpeg or avidemux.

I guess I'd try transcoding the audio first off: try 128kbps fixed-rate MP3... that has good quality, small size relative to raw PCM, and seems to work well in kdenlive. Perhaps try a higher bitrate if the audio quality isn't up to your standards.

Avidemux has a nice GUI for this.

I already had a look at the bug. There is no solution for now, only a workaround. Right-click the file in the project tree, choose Transcode > Lossless Matroska. Be sure to choose the option "Add clip to project" and then click Start. It will create a much larger file but with a low quality FLV like that you will want to preserve as much quality as possible.

I would prefer not to use the advice about transcoding to a much larger file because my full HD clips are already quite big. It seems that my clip (1920x1080) pixels is already MP3 audio and XVID video, could you look at mplayer -v output below and tell me what format to transcode to?

MPlayer 1.0rc4-4.4.5 (C) 2000-2010 MPlayer Team
CPU vendor name: GenuineIntel max cpuid level: 2
CPU: Intel(R) Pentium(R) M processor 1.70GHz (Family: 6, Model: 13, Stepping: 6)
extended cpuid-level: 4
Detected cache-line size is 64 bytes
Testing OS support for SSE... yes.
Tests of OS support for SSE passed.
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNowExt: 0 SSE: 1 SSE2: 1 SSSE3: 0
Compiled with runtime CPU detection.
get_path('codecs.conf') -> '/home/milos/.mplayer/codecs.conf'
Reading /home/milos/.mplayer/codecs.conf: Can't open '/home/milos/.mplayer/codecs.conf': No such file or directory
Reading /etc/mplayer/codecs.conf: Can't open '/etc/mplayer/codecs.conf': No such file or directory
Using built-in default codecs.conf.
Configuration: --prefix=/usr --confdir=/etc/mplayer --enable-xvmc --enable-menu --disable-arts --enable-largefiles --language=all --disable-libdvdcss-internal --disable-dvdread-internal --disable-libavutil_a --disable-libavcodec_a --disable-libavformat_a --disable-libpostproc_a --disable-libswscale_a --target=i586-linux --enable-runtime-cpudetection --enable-debug --enable-mga --enable-3dfx --enable-tdfxfb --disable-gui
CommandLine: '-v' 'avi/croatia jump off the boat.avi'
init_freetype
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
get_path('fonts') -> '/home/milos/.mplayer/fonts'
Using nanosleep() timing
get_path('input.conf') -> '/home/milos/.mplayer/input.conf'
Can't open input config file /home/milos/.mplayer/input.conf: No such file or directory
Parsing input config file /etc/mplayer/input.conf
Input config file /etc/mplayer/input.conf parsed: 91 binds
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
get_path('croatia jump off the boat.avi.conf') -> '/home/milos/.mplayer/croatia jump off the boat.avi.conf'

Playing avi/croatia jump off the boat.avi.
get_path('sub/') -> '/home/milos/.mplayer/sub/'
[file] File size is 380567012 bytes
STREAM: [file] avi/croatia jump off the boat.avi
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
LAVF_check: AVI format
AVI file format detected.
list_end=0x22E0
======= AVI Header =======
us/frame: 20000 (fps=50.000)
max bytes/sec: 33000
padding: 0
MainAVIHeader.dwFlags: (2320) HAS_INDEX IS_INTERLEAVED TRUST_CKTYPE
frames total: 4177 initial: 0
streams: 2
Suggested BufferSize: 1048576
Size: 1920 x 1080
==========================
list_end=0x113C
==> Found video stream: 0
[aviheader] Video stream found, -vid 0
====== STREAM Header =====
Type: vids FCC: FMP4 (34504D46)
Flags: 0
Priority: 0 Language: 0
InitialFrames: 0
Rate: 50/1 = 50.000
Start: 0 Len: 4177
Suggested BufferSize: 1048576
Quality -1
Sample size: 0
==========================
Found 'bih', 40 bytes of 40
======= VIDEO Format ======
biSize 40
biWidth 1920
biHeight 1080
biPlanes 1
biBitCount 24
biCompression 877677894='FMP4'
biSizeImage 6220800
===========================
Regenerating keyframe table for MPEG-4 video.
======= Video Properties Header =======
Format: 0 VideoStandard: 0
VRefresh: 50 HTotal: 1920 VTotal: 1080
FrameAspect: 16:9 Framewidth: 1920 Frameheight: 1080
Fields: 1
== Field 0 description ==
CompressedBMHeight: 1080 CompressedBMWidth: 1920
ValidBMHeight: 1080 ValidBMWidth: 1920
ValidBMXOffset: 0 ValidBMYOffset: 0
VideoXOffsetInT: 0 VideoYValidStartLine: 0
=======================================
list_end=0x21D4
==> Found audio stream: 1
[aviheader] Audio stream found, -aid 1
====== STREAM Header =====
Type: auds FCC: (1)
Flags: 0
Priority: 0 Language: 0
InitialFrames: 0
Rate: 125/3 = 41.667
Start: 0 Len: 3480
Suggested BufferSize: 12288
Quality -1
Sample size: 0
==========================
Found 'wf', 40 bytes of 18
======= WAVE Format =======
Format Tag: 80 (0x50)
Channels: 2
Samplerate: 48000
avg byte/sec: 8000
Block align: 1152
bits/sample: 0
cbSize: 22
Unknown extra header dump: [2] [0] [0] [fa] [0] [0] [1] [0] [0] [0] [1] [0] [10] [0] [0] [0] [0] [0] [0] [0] [0] [0]
==========================================================================
list_end=0x2300
hdr=Software size=12
Software : Lavf52.36.0
list_end=0x16AD1F4C
Found movie at 0x270C - 0x16AD1F4C
Reading INDEX block, 7657 chunks for 4177 frames (fpos=380444500).
AVI index offset: 0x2708 (movi=0x270C idx0=0x4 idx1=0xCC)
Auto-selected AVI audio ID = 1
Auto-selected AVI video ID = 0
AVI: Searching for audio stream (id:1)
AVI video size=379704033 (4177) audio size=668160 (3480)
VIDEO: [FMP4] 1920x1080 24bpp 50.000 fps 36361.4 kbps (4438.6 kbyte/s)
Auto-selected AVI audio ID = 1
[V] filefmt:3 fourcc:0x34504D46 size:1920x1080 fps:50.000 ftime:=0.0200
Clip info:
Software: Lavf52.36.0
get_path('sub/') -> '/home/milos/.mplayer/sub/'
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: Permission denied.
[VO_3DFX] Unable to open /dev/3dfx.
X11 opening display: :0.0
vo: X11 color mask: FFFFFF (R:FF0000 G:FF00 B:FF)
vo: X11 running at 1400x1050 with depth 24 and 32 bpp (":0.0" => local display)
[x11] Detected wm supports NetWM.
[x11] Detected wm supports FULLSCREEN state.
[x11] Detected wm supports ABOVE state.
[x11] Detected wm supports BELOW state.
[x11] Current fstype setting honours FULLSCREEN ABOVE BELOW X atoms
Disabling DPMS
DPMSDisable stat: 1
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
[VO_XV] Using Xv Adapter #0 (Radeon Textured Video)
[xv common] Drawing no colorkey.
[xv common] Maximum source image dimensions: 2048x2048
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
INFO: libavcodec init OK!
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
dec_audio: Allocating 4608 + 65536 = 70144 bytes for output buffer.
mp3lib: using SSE optimized decore!
MP3lib: init layer2&3 finished, tables done
MPEG 1.0, Layer II, 48000 Hz 64 kbit Stereo, BPF: 192
Channels: 2, copyright: No, original: Yes, CRC: No, emphasis: 0
AUDIO: 48000 Hz, 2 ch, s16le, 64.0 kbit/4.17% (ratio: 8000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
Trying preferred audio driver 'pulse', options '[none]'
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
AO: Description: PulseAudio audio output
AO: Author: Lennart Poettering
Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
Starting playback...
XXX initial v_pts=0.060 a_pos=576 (0.072)
Increasing filtered audio buffer size from 0 to 50048
[ffmpeg] aspect_ratio: 1.777778
VDec: vo config request - 1920 x 1080 (preferred colorspace: Planar YV12)
Trying filter chain: vo
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO Config (1920x1080->1920x1080,flags=0,'MPlayer',0x32315659)
VO: [xv] 1920x1080 => 1920x1080 Planar YV12
VO: Description: X11/Xv
VO: Author: Gerd Knorr and others
Xvideo image format: 0x32595559 (YUY2) packed
Xvideo image format: 0x32315659 (YV12) planar
Xvideo image format: 0x30323449 (I420) planar
Xvideo image format: 0x59565955 (UYVY) packed
using Xvideo port 63 for hw scaling
*** [vo] Allocating (slices) mp_image_t, 1920x1088x12bpp YUV planar, 3133440 bytes
Unicode font: 5103 glyphs.
Unicode font: 5103 glyphs.
*** [vo] Allocating (slices) mp_image_t, 1920x1088x12bpp YUV planar, 3133440 bytes
Uninit audio filters... 0.452 ct: -0.060 53/ 53 95% 6% 28.9% 23 0
[libaf] Removing filter dummy
Uninit audio: mp3lib
Uninit video: ffmpeg
Successfully enabled DPMS
vo: uninit ...

i had the same problem with an avi file, i found i was able to fix it simply by using avidemux to re-save the file with video and audio both set to copy, ie same video data just repackaged in a new avi file.

i found this possible clue to the problem when i played both files back in mplayer, broken file produced this messaage:

AVI file format detected.
[aviheader] Video stream found, -vid 0
AVI: No audio stream found -> no sound.
VIDEO: [FMP4] 768x576 24bpp 25.000 fps 5741.0 kbps (700.8 kbyte/s)
Clip info:
Software: MEncoder VERSION
Opening video filter: [screenshot]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 768x576 => 768x576 Planar YV12

fixed file produced this:

AVI file format detected.
[aviheader] Video stream found, -vid 0
AVI: No audio stream found -> no sound.
VIDEO: [FMP4] 768x576 24bpp 25.000 fps 5741.0 kbps (700.8 kbyte/s)
Opening video filter: [screenshot]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
[swscaler @ 0x7feae2673620]using unscaled yuv420p -> rgb24 special converter
VO: [xv] 768x576 => 768x576 Planar YV12

notice the additional line:

[swscaler @ 0x7feae2673620]using unscaled yuv420p -> rgb24 special converter

which does not appear in the original version. i don't know what it means but hopefully this may help someone.

ddennedy, openshot is affected by the same bug. Openshot and kdenlive rely on MLT. Did you file a MLT bug report? I do not feel competent to file it, because I feel that kdenlive or openshot developers are much more qualified to submit a good bug report.

gnopaks, that kdenlive bug is about a particular low res H.263 FLV video. Now you are reporting something about a HD XViD. That is quite possibly a different bug. Also, I am the lead developer of MLT. There is no need to file a separate bug report in MLT as I contribute here as well.

The first thing to do with a problem like this is to see if the file supports good and proper seeking when played back with ffplay at the command line. If it does not work in ffplay, then it is a bug or known shortcoming in FFmpeg.

Also, if you want to do video editing you need to be prepared to transcode. As much as we try to not require it that is still the reality because there are many standards, formats, and tools heaped upon a complexity that generates a whole mess of interoperability problems. If you do not have the storage capacity or patience to deal with it at a HD level, then consider SD.

The idea of using avidemux works for me. It is a good workaround. Attached is a python script I cooked up to fix all files in a folder. Replace equal signs with tabs or spaces (forum destroys whitespace indentation).
import os
Base = os.getcwd()
os.chdir(Base)
for F in os.listdir(Base):
=Suffix = F.split('.')[-1]
=Name = '.'.join(F.split('.')[0:-1]) # Filename without suffix
=if Suffix.lower() == 'avi' and not Name.endswith('_fixed'):
==cmd='/usr/bin/avidemux2_cli --load "%s" --save "%s_fixed.avi" --quit' % (F,Name)
==print cmd
==w,r=os.popen2(cmd)
==w.close()
==print r.read()

ddennedy, thank you for useful information. I did not know these things. I tested my broken files for proper seeking with ffplay.

ffplay cannot seek in the broken file. mplayer can seek in the broken file.

Then I "fixed" the file by using avidemux2_cli "copy". Now ffplay can seek a few times in the "fixed" file, then the seeking breaks down - picture and sound are out of sync... but mplayer can seek in the "fixed" file and kdenlive can seek in it, too.

With this workaround I can continue using kdenlive.

I would like to contribute the broken file to the 1616 bug report to see if it is the same error or a different one.

Just to clarify. my broken files are a result of taking a Canon HF10 AVCHD *.MTS files, non-interlaced Full HD resolution, and transcoding them with "ffmpeg -qscale 4 -i input.avi output.avi"