Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix flv files that stop early

Tags:

flv

I downloaded some flv videos some time ago and when watching them they stop at a point. If I skip past that point they continue playing fine up until another point which I can then skip past again (and the cycle goes on until the end of the video)

I already tried

avconv -i input.flv -acodec copy -vcodec copy -g 1 output.flv

To my understanding from reading alot of mostly useless posts regarding this issue the there isn't any keyframes in my metadata and then stop when there is a bad frame.

I tried setting -g higher but output.flv stops at the same point as where the original file stops for the first time. Is there any tool that can fix this.

I can't remember where the original links are located and re-downloading isn't a option and as you can see my re-encoding attempts has failed.

I am using Linux Ubuntu, so I can't use the Windows tools that are available.

EDIT

After alot of struggle I still haven't been able to fix the file.

I was wrong in my assumption that the MetaData is the problem. After trying an array of tools I found that most of them stopped with End of File (In the middle of the file).

The Metadata is what it should be. (I successfully extracted it). It seems the streams is corrupt. I tried re-muxing,re-encoding injecting MetaData none of them worked they produced file that still stuck at same spot or simply the stream up until the bad spot.

My problem is the exactly the same as listed here : link

Any help would be greatly appreciated. I'll take any solution even if I have to hack out a bit of the file with a hex editor. (I tried removing what I though was the bad bit but that caused it to not play at all)

I have a Windows machine at my disposal now so running windows utilities isn't a problem any more.

like image 860
Xonar Avatar asked Oct 06 '22 06:10

Xonar


2 Answers

I fixed it.

Not the solution I was hoping for, but I managed to split the file into different bit using avconv

avconv -ss "$TIME" -i "$IN" -vcodec copy -acodec copy "$OUT"."$PART".mkv

Putting ss before the input file caused it to use keyframes to jump to the correct location and then didn't run into the corrupt bit and crash. After each corrupt bit I repeated the previous step with the new $TIME.

Finally I added all the bits together with avconv concat option and now it works. When reaching a previous corrupt bit the videos jumps a bit forward, but that's fine.

like image 104
Xonar Avatar answered Oct 10 '22 00:10

Xonar


I've got many old FLV files that ffmpeg stops just after start, I made it work properly using

ffmpeg -flv_ignore_prevtag 1 -i file.flv -c ...

Check out https://ffmpeg.org/ffmpeg-all.html#flv_002c-live_005fflv for more information

like image 41
Micael Silva Avatar answered Oct 10 '22 01:10

Micael Silva