Hi guys,
I'm completely lost
I have a huge restoration project, where I have to capture old videos from a server.
the actual files are not accessible, so I use internet download manager to capture them.
the videos play fine but here is the thing.
At the begging, video and audio are synced.
but as the video plays along, it seems like it's increasingly going faster and faster than the audio.
I assumed that it was due to inconsistent framerate while capturing, so i tried re-encoding the video with handbrake while choosing "constant framerate"
but once re encoded, the video and audio are still not synced, and the difference is still variable ( not a permanent unsynced, but an increasing one)
how can it be?
if I lock the framerate how can this still happen?
appreciate all the help i can get.
Thanks !
+ Reply to Thread
Results 1 to 30 of 31
-
-
get access to the original files. if you can't you probably don't have permission anyway.
--
"a lot of people are better dead" - prisoner KSC2-303 -
The original files are small chunks of data combined by a very old specially programmed player for an old project.
this was developed several years ago, and there is no way to get the person who builds this.
the owner lost his own originals (previously tapes) so he wants to get whatever he can from the old streaming server.
I don't see how the permission issue is related to my video rendering question. -
if the source files are going out of sync than no amount of re-encoding them will solve the issue. all you are doing is changing the format. you could try using video editing software to separate the audio and video which would allow you to stretch or shrink the audio to try and get them to align.
--
"a lot of people are better dead" - prisoner KSC2-303 -
Hi,
thank you for your reply.
when I play the videos on the dedicated player the sound is fine.
but when I capture it with IDM this sync issue occurs.
i was thinking that making the frame rate constant will make the async stable, than once synced on an editing program the whole video will be synced.
but I'm syncing a specific spot, and everything else becomes unsync -
I thought that cases like this are caused by variable framerate. is that the case?
if that's the case, why re-encoding to a constant frame rate doesn't make the sync issue constant?
if it was constant, I could have easily fix it with an editing program.
giving that the sound isn't cutting, and running in a constant past, if I'm making the video run in a constant paste, it should solve it, shouldn't it ?
what am I missing ? -
-
If it's variable framerate and in sync - in a normal media player - then converting to CFR will keep it pretty much in sync too (might be slightly in/out of sync in sections, but would be very minor). Answer the question about MPCHC, VLC played locally. If it's already out of sync, then the problem is likely downloading and appending segments.
Other causes are problems downloading and appending segments - Gaps and offsets of audio and video stream of each segment cause it to be progressively out of sync. It might be ok for 1 segment, but for example, the audio is 40ms longer than the video. But you have 20 segments. By the end you have 800ms longer audio because each segment audio is longer than the video. It can be the reverse case - longer video than audio too. Mismatched AV duration causes progressively out of sync -
[QUOTE=poisondeathray;2607194] Hi,
the problem is defiantly when downloading.
all players open it in the same way.
it starts with no/very little delay at the beginning than in the end, the video ends, and the audio keeps running for another 1 minute or so...
that happens on all videos that are about 1 - 1:20 hours long...
in all of them, this async is pretty much the same.
is there any way to bypass this?
maybe capture it in a different way?
IDM was the only tool that recognized this stream and was able to capture it... -
Maybe wrong, but this is exactly what used to happen to me when I used to capture video streams (from any source) using my Elgato capp card and their proprietary software. The RAW stream was in TS format and I used to process it (Save it to disk) to Mp4 using the bundled app. The resultant Mp4 from the TS started off in perfect audio sync, but gradually got out of sync thereby impossible to pull back with Avidemux copy delay as it was a progressive error not a constant delay.
The solution (for me) and still is, is to save the capp in TS format and use ffmpeg to 'convert' it Mkv or Mp4
Code:ffmpeg -i input.ts -c copy output.mkv
you don't say what format the videos are in that you are downloading.
Few more details/stats required I think before anyone can help/assist you. -
Hi,
thanks for the input.
IDM saves the files as Mp4.
It seems that some are 25FPS and some are 60.1FPS and 24.18FPS and 30.17FPS and so on...
i assume that the FPS that I see when I right-click on a file doesn't mean too much, because it's changing and not constant.
that's why I was thinking that if I set the video to a constant frame rate the delay will become stable and not variable... -
Tryied to do what you said, on the MP4 file.
the output file has the same delay issue...
ffmpeg -i bdt7.mp4 -c copy bdt7mkv.mkv
ffmpeg version 4.3.1-2021-01-01-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bdt7.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
Duration: 01:22:00.03, start: 0.000000, bitrate: 1299 kb/s
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1024:1024 DAR 4:3], 1233 kb/s, 30.17 fps, 30 tbr, 1k tbn, 59.94 tbc (default)
Metadata:
handler_name : USP Video Handler
encoder : AVC Coding
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 61 kb/s (default)
Metadata:
handler_name : USP Sound Handler
Output #0, matroska, to 'bdt7mkv.mkv':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1024:1024 DAR 4:3], q=2-31, 1233 kb/s, 30.17 fps, 30 tbr, 1k tbn, 1k tbc (default)
Metadata:
handler_name : USP Video Handler
encoder : AVC Coding
Stream #0:1(und): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 61 kb/s (default)
Metadata:
handler_name : USP Sound Handler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=147452 fps=59091 q=-1.0 Lsize= 775454kB time=01:22:00.00 bitrate=1291.2kbits/s speed=1.97e+03x
video:735921kB audio:37038kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.322720% -
Hi,
sure:
General
Complete name : C:\bdt7.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 762 MiB
Duration : 1 h 22 min
Overall bit rate mode : Constant
Overall bit rate : 1 300 kb/s
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3
Format settings : 2 Ref Frames
Format settings, CABAC : No
Format settings, Reference frames : 2 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 h 21 min
Source duration : 1 h 21 min
Bit rate mode : Constant
Bit rate : 1 241 kb/s
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Variable
Frame rate : 29.970 FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.135
Stream size : 719 MiB (94%)
Source stream size : 719 MiB (94%)
Color range : Limited
Codec configuration box : avcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 1 h 22 min
Bit rate mode : Constant
Bit rate : 62.0 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 36.2 MiB (5%)
Default : Yes
Alternate group : 1 -
An Avisynth script like this has worked well in the past, it forces a constant frame rate.
Then encode in Virtualdub or StaxRip
Code:Audio = lwlibavAudioSource("c:\path\movie.mp4") video = lwlibavVideoSource("c:\path\movie.mp4", fpsnum=30000, fpsden=1001) # force 29.97 fps Video = Video.ConvertToYV12() Audiodub(video,audio)
-
@OP
Code:IDM was the only tool that recognized this stream and was able to capture it...
-
Hi,
I can't do that unfortunately, it's a local server, not concerned to the internet.
I need to physically go to the customer and connect to his lan to access the streams.
What software can capture it other than IDM ?
IDM was the only one that recognise this stream for me and show the download option.
P.s when IDM recognise is, it shows the video length instead of it's size.
What other software can recognise it ?
I can try again... -
-
They are all extremely capable of downloading a stream in chunks and reforming it into one single entity. As jagabo has stated you need to use the F12 (DevTools) of your browser to search for either an mpd or m3u8 or some other playlist url to be able to download the file in its original RAW format - more than likely TS. We can then convert it afterwards to your preferred format. We don't want IDM converting a TS to Mp4 'on the fly' and f*king it up.
Unless you give us some more information, or the url (and / or access) to what you are trying to download - its impossible to advise you my friend.
With any of the above mentioned tools we can also download (if necessary) separate audio and video streams and reform them post-download. In sync.
IDM, albeit a great downloading tool in certain circumstances is the problem in this instance - not the files on the server. If you persist with IDM you will keep reproducing the error you are trying to eradicate 'ad infinitum'. There is no magical setting in IDM that we can advise that will solve this issue.
Also, Handbraking or Staxripping a video that is progressively out of sync will not cure the issue.Last edited by codehound; 16th Jan 2021 at 18:40.
-
I really appreciate everyone's help with this.
I was able to convince my customer to get me a PC and connect it locally with a Teamviewer session.
I can't share the connection, unfortunately, but I did try what you suggested.
So,
I found the .mpd file and ran the command on FFMPEG.
it seems like the server returns several versions to choose from. (different bitrates) I saw it on IDM also and I see it on the player, In the following example, it seems that FFMPEG has chosen the best one (highest bitrate) but can I control it?
can you look at the command am I doing it correctly?
I will update once the capturing ends if this works this way or still out of sync.
here is the output from FFMPEG:
C:\ffmpeg\bin>ffmpeg.exe -y -i https://192.168.2.28/trainvs/112/112708/112708.ism/112708.mpd?ssauth=29273924-112708-2...hdffcdhaa0a041 test1.mp4
ffmpeg version 4.3.1-2021-01-01-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, dash, from 'https://192.168.2.28/trainvs/112/112708/112708.ism/112708.mpd?ssauth=29273924-112708-2021d4345943-dh7f3b9e8ec362fgdfghdffcdhaa0a041':
Duration: 01:22:00.00, start: 5.015510, bitrate: 0 kb/s
Program 0
Stream #0:0: Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 320x240 [SAR 1024:1024 DAR 4:3], 102 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
Metadata:
variant_bitrate : 194000
id : video=194000
Stream #0:1: Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 480x360 [SAR 1024:1024 DAR 4:3], 206 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
Metadata:
variant_bitrate : 397000
id : video=397000
Stream #0:2: Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 480x360 [SAR 1024:1024 DAR 4:3], 367 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
Metadata:
variant_bitrate : 702000
id : video=702000
Stream #0:3: Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1024:1024 DAR 4:3], 650 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
Metadata:
variant_bitrate : 1235000
id : video=1235000
Stream #0:4: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 30 kb/s
Metadata:
variant_bitrate : 62000
id : audio=62000
Stream mapping:
Stream #0:3 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:4 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000028dbedcad80] using SAR=1/1
[libx264 @ 0000028dbedcad80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000028dbedcad80] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0000028dbedcad80] 264 - core 161 r3027 4121277 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test1.mp4':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1024:1024 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
variant_bitrate : 1235000
id : video=1235000
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
variant_bitrate : 62000
id : audio=62000
encoder : Lavc58.91.100 aac
[dash @ 0000028dbe30d2c0] No longer receiving stream_index 0
[dash @ 0000028dbe30d2c0] No longer receiving stream_index 1
[dash @ 0000028dbe30d2c0] No longer receiving stream_index 2
frame=16373 fps= 43 q=29.0 size= 37120kB time=00:09:06.76 bitrate= 556.2kbits/s dup=1 drop=0 speed=1.42x -
With ffmpeg be sure to specify "-c copy" so the audio and video don't get reencoded (unless that's what you want). I'm sure ffmpeg has some way of letting you specify which of the available streams you want -- but I don't know the program well enough to tell you how.
I do know how to get a list of streams and how to specify which one you want with youtube-dl. To get a list of available streams:
Code:youtube-dl -F URL
Code:format code extension resolution note audio-English_stereo mp4 audio only [en] 628 mp4 320x180 628k , avc1.42c00d, video only 928 mp4 480x270 928k , avc1.42c00d, video only 1728 mp4 640x360 1728k , avc1.42c00d, video only 2528 mp4 960x540 2528k , avc1.42c00d, video only 4928 mp4 1280x720 4928k , avc1.42c00d, video only 9728 mp4 1920x1080 9728k , avc1.42c00d, video only (best)
Code:youtube-dl -f 4928+audio-English_stereo URL
-
OK so great news finally !!!!
the videos get encoded and the audio is synced!
two last questions, if anyone knows how to choose a specific stream to be recorded,
second, the quality seems to be a little less good than the one I see on the web player.
is there any way to improve that? -
Why don't you explicitly say what worked for you? It may help the next person with a similar problem.
Using what program? I gave you examples with youtube-dl.
If you reencoded as in post #23 -- of course the quality is less. You reencoded with a lossy codec. Every reencode with a lossy codec will reduce quality.
Don't reencode. With ffmpeg use "-c copy" instead of reencoding. If the source has chapters or subtitles also use "-map 0".
Code:C:\ffmpeg\bin>ffmpeg.exe -y -i https://192.168.2.28/trainvs/112/112708/112708.ism/112708.mpd?ssauth=29273924-112708-2021d4345943-dh7f3b9e8ec362fgdfghdffcdhaa0a041 -map 0 -c copy test1.mp4
Last edited by jagabo; 17th Jan 2021 at 06:57.
-
For ffmpeg stream selection, use -map
eg.
-map 0:3 -map 0:4
would select 0:3 and 0:4, or the 640x480 video with the only aac audio
You have to look at the console output for specific stream map numbering (each video might be different)
-c:v copy means copy video stream (original quality)
-c:a copy means copy audio stream (original quality) -
[QUOTE=poisondeathray;2607693]For ffmpeg stream selection, use -map
eg.
-map 0:3 -map 0:4
would select 0:3 and 0:4, or the 640x480 video with the only aac audio
You have to look at the console output for specific stream map numbering (each video might be different)
thanks !
will try it now !Last edited by tzimber; 17th Jan 2021 at 08:38.
-
It seems like it doesn't recognise the mapping...
it returns this:
Option map (set input stream mapping) cannot be applied to input url https://192.168.2.28/trainvs/112/112708/112708.ism/112708.mpd?ssauth=29273924-112708-2...hdffcdhaa0a041 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file https://192.168.2.28/trainvs/112/112708/112708.ism/112708.mpd?ssauth=29273924-112708-2...hdffcdhaa0a041
Error opening input files: Invalid argument -
OK got it !
the -MAP should be after the URL.
let's see how it will come out.
thanks!
Similar Threads
-
Converting to constant framerate with Handbrake - Audio out of sync
By m1ke in forum Video ConversionReplies: 3Last Post: 1st Nov 2020, 18:27 -
Audio sync problem — video goes out of sync after a while
By maxalfreeman in forum AudioReplies: 4Last Post: 12th Sep 2019, 13:07 -
Handbrake: How can I convert video only and leave the audio untouched?
By Foebane72 in forum Video ConversionReplies: 2Last Post: 9th Oct 2016, 10:18 -
Audio pitch after video is convert using handbrake or video coder
By Freelife2345 in forum AudioReplies: 3Last Post: 9th May 2016, 02:33 -
VirtualDub audio out of sync, other video players all in sync
By a1s2d3f4 in forum Newbie / General discussionsReplies: 7Last Post: 11th Apr 2016, 21:36