FLV conversion with synchronization

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
l a n
New Cone
New Cone
Posts: 5
Joined: 04 Oct 2011 00:39

FLV conversion with synchronization

Postby l a n » 04 Oct 2011 00:58

Hello,

I try to convert an flv file to another container (for example avi).

The file I'm trying to convert can be downloaded until 24th october 2011 here:
http://www.megaupload.com/?d=7ZY9WUB8

I had no luck so far with ffmpeg, mencoder, flvextract and mkvmerge. So I tried vlc version 1.1.9 but also without luck. The file should be 27:40 min and at 11:31 min the woman speaks.

Does someone have an idea how to convert that file with correct a/v synchronization ?

Thanks

Lotesdelere
Cone Master
Cone Master
Posts: 10113
Joined: 08 Sep 2006 04:39
Location: Europe

Re: FLV conversion with synchronization

Postby Lotesdelere » 04 Oct 2011 09:45

The timestamps of this file are badly broken, maybe because of the low FPS used and/or the variable framerate and/or a bad source and/or a poor file writing app, and I'm not sure what to do since the playback is already jerky. Try with AviDemux or maybe some DirectShow through GraphEdit solution.

Code: Select all

General Format : Flash Video _videodevice : USB-Videogert _framerate : 20.000 Video Format : AVC Frame rate mode : Variable Frame rate : 10.000 fps

l a n
New Cone
New Cone
Posts: 5
Joined: 04 Oct 2011 00:39

Re: FLV conversion with synchronization

Postby l a n » 04 Oct 2011 16:36

Hello Lotesdelere,

thank you for looking at the file.

I recorded the FLV file from a video stream of dacast.com with rtmpsuck version 2.3.

svn://svn.mplayerhq.hu/rtmpdump
revision: 569

Not sure whether rtmpsuck is the problem, dacast.com or whatever.
The timestamps of this file are badly broken
Currently, I try to understand what the timecodes of FLVExtract can tell me.

Code: Select all

wget http://moitah.net/download/latest/FLV_Extract.zip unzip FLV_Extract.zip mono FLVExtractCL.exe -v -a -t videostream_2011-09-27_23-42-16.flv
The command above produces 3 files:
1. video: 27:56 min, H.264
2. audio: 27:40 min, MP3
3. timecodes: 16768 lines at 10 frames per second = 1676.7 seconds = 27:56 min

When I look at the timecodes, I can see 125 times 0 at the beginning:

Code: Select all

less -N videostream_2011-09-27_23-42-16.txt
At 10 frames per second, each line seems to represent 0.1 seconds.

As far as I understand, this means that with 125 lines 0 I have to skip 12.5 seconds of the video to be in sync with the audio :? ?

What I do not understand are the mixed values of relative and absolute times in the timecodes:

Code: Select all

line 127: 63 line 128: 163 line 129: 14051989 ... line 202: 14059289 line 203: 7663 line 204: 14059489
Line 127 contains the relative value 0.063 seconds since the start of the video and line 203 is 7.663 seconds since the start of the video.
Besides that are absolute values like 14051989 == 14051.989 seconds == 3:54:12 which could be the start of the video stream from the webserver :? ?


What I am going to try is cut the video at the beginning by 12.5 seconds and at the end so that audio and video have the same length. After that audio and video could be multiplexed together.

If I have success, I'm going to post the program / command lines that I use.

Lotesdelere
Cone Master
Cone Master
Posts: 10113
Joined: 08 Sep 2006 04:39
Location: Europe

Re: FLV conversion with synchronization

Postby Lotesdelere » 05 Oct 2011 09:50

I recorded the FLV file from a video stream of dacast.com with rtmpsuck version 2.3.
You should use RtmpDump itself which is, as its name says, the dedicated tool for dumping a stream.

I don't know much about FLVExtract because I'm usually using FFmpeg like this:

Code: Select all

ffmpeg -i videostream.flv -vcodec copy -acodec copy output.mp4
Anyway, this is the VLC forum. If you want more information about FLVExtract, timecodes and the FLV format itself I suggest you to go to dedicated forums such as Doom9.org, Doom10.org and VideoHelp.com.

l a n
New Cone
New Cone
Posts: 5
Joined: 04 Oct 2011 00:39

Re: FLV conversion with synchronization

Postby l a n » 08 Oct 2011 18:47

Meanwhile I a found a conversion that works more or less. So I post my bash script just in case someone else has the same problem:

Code: Select all

#!/bin/bash if [ ! $# -eq 1 ];then echo "Use the flv file as parameter" exit 1 fi # remove existing video streams from RAM disk rm -f /dev/shm/video* # extract audio, video and timecodes mono FLVExtractCL.exe -d /dev/shm/ -v -a -t "$1" # create index for flv video ffmpeg -y -i /dev/shm/*.264 -vcodec copy /dev/shm/video.mp4 # remove the h264 video to get more free space rm -f /dev/shm/*.264 # calculate an offset for audio and video synchronization offset=$(expr $(grep "^0$" /dev/shm/videostream*.txt | wc -l) - 1 | sed 's/\(.*\)\(.\)$/\1.\2/') # multiplex audio and video together with mencoder with an offset mencoder /dev/shm/video.mp4 -audiofile /dev/shm/video*.mp3 -oac copy -ovc copy -delay -$offset -o /dev/shm/video.avi
Anyway, this is the VLC forum. If you want more information about FLVExtract, timecodes and the FLV format itself I suggest you to go to dedicated forums such as Doom9.org, Doom10.org and VideoHelp.com.
OK. I see that VLC is currently not able to play or convert that particular FLV file. I'll have a try at Doom9.org.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 74 guests