Giter VIP home page Giter VIP logo

Comments (11)

patademahesh avatar patademahesh commented on July 2, 2024 1

The another solution to this is,

1. extract only audio from the source
2. split video(ts) without audio
3. concat ts
4. stitch audio extracted in first step

from distributed-video-transcoding.

patademahesh avatar patademahesh commented on July 2, 2024

No I have never noticed this because, I haven't seen any audio issues in converted videos.

I have never used acvonv so don't have much idea.

from distributed-video-transcoding.

rebotnix avatar rebotnix commented on July 2, 2024

thanks for your response.

can you please confirm that the basics ffmpeg part that your script is doing is this:

splitting with transcoding:
./ffmpeg -ss 0 -i input.mp4 -t 3 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -f mpegts -strict experimental -y part1.ts

./ffmpeg -ss 3 -i input.mp4 -t 3 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -f mpegts -strict experimental -y part1.ts

and so on with more parts...after transcoding...

muxing / merging back from nodes like:
./ffmpeg -y concat:part1.ts|part2.ts -c copy -bsf:a aac_adtstoasc -y merged.mp4

that´s it, right?

i think the reason why you don't hear the audio glitch is that when you only have 2 or 4 nodes and a playtime of , lets say 60 minutes, the first split is (lets say with 2 nodes) is at time position 30 minutes.

When you seek to minute 29:50 wait till minute 30 you maybe will hear that split / audio glitch. i only tested with aac audio codecs, maybe other codecs are better for splitting. When you test with lower values, lets say split and merge every 3 seconds, then the glitches are more hearable.

It would be nice when you can try this out, maybe with much smaller splits evey 3 seconds what i´m doing right now.

thanks for any help.

from distributed-video-transcoding.

patademahesh avatar patademahesh commented on July 2, 2024

Yes you are right. This is the main ffmpeg logic.

I'll try this with very small video.

from distributed-video-transcoding.

patademahesh avatar patademahesh commented on July 2, 2024

You are right there is some glitch while concatenating. Do you have any better way to do this ?

Please suggest.

Thanks buddy.

from distributed-video-transcoding.

rebotnix avatar rebotnix commented on July 2, 2024

no problem, i tought that it is not so easy to get split and stich working. another problem i have seen is that DTS and PTS seems not to concated right when you use the concat function in combination with ffmpeg, i had some success with resetting timestamps before concating, but thats another issue we have with video splitting vs. audio cutting.

for audio: my idea is to analyze the audio track with an filter plugin for the sample cut. normal audio with 44.100 HZ samples are not so easy to split, but possible. i tested it yesterday with an hacked own written audio filter plugin and it works. i will include the patch into the main ffmpeg repo and hope that the developers of ffmpeg will add this as well.

from distributed-video-transcoding.

paulm17 avatar paulm17 commented on July 2, 2024

I have a solution, according to SO: https://stackoverflow.com/questions/46577437/ffmpeg-concat-drops-audio-frames aac drops packets, which is why you get the gaps.

This fixed it for me.


// Break down file into segments by seconds
ffmpeg -i test.mp4 -f segment -segment_time 150 -c copy -map 0 -copyts -muxdelay 0 test_%03d.ts &&

// loop through each file and transcode it, keep pcm codec as aac drops packets
for i in test_*.ts;
  do name=`echo $i | cut -d'.' -f1`;
  echo $name;
  ffmpeg -i "$i" -codec:v libx264 -codec:a pcm_s16le -copyts -threads 6 "t_${name}.ts"
done &&

// rejoin segments into single file
ls -v test_*.ts | xargs cat | ffmpeg -i - -c copy -movflags faststart output.mp4

from distributed-video-transcoding.

patademahesh avatar patademahesh commented on July 2, 2024

@paulm17 Thanks for posting answer. But in this case you will end up changing audio codec to pcm_s16le.

Correct me if i'm wrong.

from distributed-video-transcoding.

paulm17 avatar paulm17 commented on July 2, 2024

Nope, you are correct. You have to use either pcm_s16le or flac as they won't suffer the same problem as aac.

Or if you want to avoid the issue another way. use -codec:a copy.

If you read the SO answer. You'll see why aac results in issues.

from distributed-video-transcoding.

patademahesh avatar patademahesh commented on July 2, 2024

yes i read that.
When to use -codec:a copy ? while generating ts ?

from distributed-video-transcoding.

paulm17 avatar paulm17 commented on July 2, 2024

no, when you transcode it.

Original: ffmpeg -i "$i" -codec:v libx264 -codec:a pcm_s16le

Use: ffmpeg -i "$i" -codec:v libx264 -codec:a copy

This is from memory, but I think its correct.

from distributed-video-transcoding.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.