Transcoding to webm with ffmpeg audio problems - audio

For the past few days, I have been trying to get my lossless .mov video(that has an audio track) to a .webm format.
Some info on the video & audio is that the fps is 30. Also the audio track has about 3-5 seconds of silence/blank audio before you start hearing some music.
My problem is that is seems during the transcoding to webm, it strips away this blank audio because when I go to play the video, the audio starts right away.I've also notice that it jumps right away to ~4 seconds in the video. When i play it on the browser, it jumps to that moment in the timeline. If I try to scrub to the beginning, the video ends.
I've have figured somethings out.
This is just a webm problem. This does not happen with ogv or mp4
It only happens if they is blank audio in the beginning of the audio track.
I am using ffmpeg with the libvpx and libvorbis librarys and I am doing just the basic command line setup
ffmpeg -i "infile" "outfile.webm"

Related

Mux segmented mpegts audio and video to single clip with error correction

I have a recording as a collection of files in mpegts format, like
audio: a-1.ts, a-2.ts, a-3.ts, a-4.ts
video: v-1.ts, v-2.ts, v-3.ts
I need to make a single video clip in mp4 or mkv format.
However, there are two problems:
audio and video segments have different duration each, number of audio segments is different from number of video segments. Total duration of audio and video matches. Hence I can not concat pairwise audio video segments using mpeg and merge them afterwards, I get sync issues increasing progressively
few segments are corrupt or missing. So if I concat audio and video streams separately using ffmpeg I get streams of different lengths. When I merge these streams using ffmpeg I have correct a/v synchronization until time when first missing packet is encountered.
It's OK if video freezes for a while or there is silence for a while as long as most of the video is in sync with audio.
I've checked with tsduck and PCR seems to be present in all audio and video segments yet I could not find a way to merge streams using mpegTS PCR as sync reference. Please advise how can I achieve this.

ffmpeg duplicate last frame as long as the audio length

I am recording AVI files with Camtasia. For some reason the video stream length is 2,3-5 seconds less than the audio stream.
When I convert the video with ffmpeg from AVI to MP4 it cuts the audio to the video length.
Would duplicating the last frame until the end of the audio be a solution? If yes how can this be done using ffmpeg?
The important thing is to convert the AVI to MP4 using ffmpeg and keep the audio stream of the video complete.
Thank you.
Edit 1: This issue is automatically solved by ffmpeg 2.x somehow but ffmpeg 4.x will cut audio. With the same settings the old version converts correctly.
Edit 2: tpad helped. Thank you very much #kesh. I used
-filter_complex 'tpad=stop=NUMBER_OF_FRAMES:stop_mode=clone'
I tried to get the duration using ffprobe and multiplied the number of seconds with number of frames per second but it was not enough. For each video I had to increase that number with 100,150 frames.
The issue is I cannot detect the exact number of frames to tell tpad. I also tried
-filter_complex 'tpad=stop=-1:stop_mode=clone'
but it freezez while processing.
Is there any other option?

ffmpeg - correctly handling misaligned audio/video input stream before outputting to rtmp

I use a video player called MPV to transcode a dynamic playlist of media files.
I pipe MPV's encoded output into FFMPEG and format it for rtmp delivery.
However the playlist may contain media with misaligned audio and video, ie - the audio track may be shorter / longer than the video track.
No matter what MPV will only output what it's given. So if my media file has audio that is 1 second long and video that is 2 seconds long, it will output a media stream with exactly the same misalignment, rather than generating null audio or skipping to the next item in the playlist when it first encounters an active stream ending (eof).
For example, assuming my playlist was full of problematic media where the audio and video of each file was misaligned:
If I output this media stream to a popular streaming service's server, it could lead to stuttering and/or loss of a/v sync.
Similarly, if I output this media stream to a file and played it back in MPV or another video player, the result appears to be more like this:
I have tried to fix this in MPV in all sorts of ways, trying every relevant command line option available. I even wrote a user script that detects 'eof' audio and skips to the next item in the playlist, but it is not fast enough and still leads to small gaps of audio.
So my only hope is correcting it in ffmpeg. In the event of null audio/video, I need a fallback or a generative filter that can fill these empty gaps with silence (audio) or a colour/image (video).
I'm open to any ideas, and if my understanding in a/v encoding is a little off please educate me.

How to copy paste audio track from/to mp4

i have 2 video streams,
DVD is a big (4.6 GB) iso file white a dutch audio track (it's my own dvd)
Mp4 is a small (800MB) mp4 file white a eng audio track.
I search for a tool that van pick the audio track from the DVD and place it in the mp4, how can i do this?
jens.
Handbrake did the job, everything works find now.

H.264+AAC in MP4 muxing bug: Plays OK in VLC but Quicktime is silent

I'm working on MP4 muxing software that takes input from a hardware H.264 encoder and AAC-LC encoder. The file I produce plays OK in VLC, but audio is silent in Quicktime or when loading into Sony Vegas. If I "convert" the file through VLC to another .mp4, or use Handbrake to convert it, then audio works in Quicktime or Vegas from the resulting file.
Here is an example file I produced (8MB, 5 sec) which demonstrates the problem.
I'm picking through mp4 headers at the moment playing spot-the-difference but not coming up with much.
Any clues on debugging this, useful analysis utilities etc, would be welcome.

Resources