PDA

View Full Version : For the pros: Different length in audio- and file of the same stream


sebastian
03-19-2012, 02:42 PM
Hi guys,

when downloading and merging the video files of be-at.tv (e.g. hxxp://www.be-at.tv/brands/wmc/surfcomber/waveform-with-victor-calderone-guests/ida-engberg.go ), the video and audio file (which are splitted) do have different lengths.

In my shown example, the downloaded mp3 is 01:28:36, but the video is 01:28:49! Also the video slider at the website itself shows 2nd length.

So how can I get the video and audio in sync? And what is the master lenght?

I guess this is a question for the pros. ;-)

Thanks in advance!

Bahman
03-19-2012, 04:41 PM
2nd one is master length, for sure!!
Avidemux can do this trick(sync) I think without re-encoding!!

sebastian
04-13-2012, 01:22 PM
2nd one is master length, for sure!!
Avidemux can do this trick(sync) I think without re-encoding!!

Ok, and do you know how?

svnpenn
04-13-2012, 04:14 PM
Just use FFmpeg

ffmpeg -i video.flv -i audio.mp3 -c copy out.flv

greenythebeast
04-13-2012, 04:29 PM
What codec is the audio?

svnpenn
04-13-2012, 04:39 PM
What codec is the audio?

In my shown example, the downloaded mp3
​​​​​

greenythebeast
04-13-2012, 04:48 PM
​​​​​

ah, i see. when using ffmpeg try adding "-async 1" without the quotes.

sebastian
04-14-2012, 07:46 AM
Okay, so this is the solution?

ffmpeg -i video.flv -i audio.mp3 -c copy out.flv -async 1

My 2nd question is: Is there also a solution for first demuxing the video? I muxed them with mencoder.exe.

Now I'd like to write a batch file, that first splits the audio and video, and after that muxes it again via the code you told me.

svnpenn
04-14-2012, 12:55 PM
You should be able to just "remux" the file.

Say you have a file with 1 video stream and 1 audio stream. You can do

ffmpeg -i bad-video.flv -c copy good-video.flv

If indeed you need to do it in 2 steps you can do this

ffmpeg -i bad-video.flv -map a -c copy astream.mp3
ffmpeg -i bad-video.flv -map v -c copy vstream.flv
ffmpeg -i vstream.flv -i astream.mp3 -c copy good-video.flv

sebastian
04-15-2012, 09:31 AM
Okay, but I'd have to add -async 1? Like ffmpeg -i bad-video.flv -c copy good-video.flv -async 1?

svnpenn
04-15-2012, 11:32 AM
Ok this is what I did

PAGE
be-at.tv/brands/wmc/surfcomber/waveform-with-victor-calderone-guests/ida-engberg

GET AUDIO
rtmpdump \
-r rtmp://media.cdn.be-at.tv \
-a cfx/st \
-W http://www.be-at.tv/v2/2/7/HostMovie.swf \
-y Session001216/Audio001284/128 \
-o Audio001284.flv

GET VIDEO
DownThemAll, Batch Download
video.cdn.be-at.tv/Session001216/Video002677/1000.[000:100].flv

MERGE
Merge videos with Avidemux, then combine with audio
ffmpeg -i 1000.000-100.flv -i Audio001284.flv -c copy video-audio.flv

sebastian
04-22-2012, 09:31 AM
Thanks a lot guys, am going to try this!

sebastian
06-05-2012, 12:54 PM
One other question: How can I append multiple files in AviDemux? Append 100 files one after one is very difficult. ;-)

svnpenn
06-05-2012, 11:13 PM
One other question: How can I append multiple files in AviDemux? Append 100 files one after one is very difficult. ;-)

Just highlight all of them and drag to the program; thats what I did.

sebastian
06-06-2012, 10:12 AM
That works, thanks! And I can be sure, that AviDemux will add it in the right order (alphabetically)?

svnpenn
06-06-2012, 12:58 PM
That works, thanks! And I can be sure, that AviDemux will add it in the right order (alphabetically)?

Should do :)

sebastian
06-07-2012, 10:02 AM
Okay I see the problem of be-at.tv now:

The videostream is missing frames every now and then. So if I use a constant frame rate, the video will always be shorter than the audiostream. I figured it out when I saw, that sometimes my downloaded video is getting slower and faster.

When watching the video via the website, the video get's resynced to the audio every few seconds.

So, right now it's turning out into the pro-question ;) : How can I merge the video-chunks AND have it synced to the audio?

sebastian
06-08-2012, 05:42 AM
Alternatively, is there a way to stretch the video via its framerate, so that it fits the audio length?

sebastian
06-08-2012, 01:35 PM
My 2nd question is answered with the following string, which syncs the video to the audiostream:

ffmpeg -i video.flv -vsync drop -i audio.flv -c copy video-audio.flv -map 1:1

If anyone does have a better solution, please help me. :-)


EDIT: That didn't help. It only changed the length of the videoindex, not the framerate. :-(