Register

Author Topic: ffmpeg guru's  (Read 119 times)

0 Members and 1 Guest are viewing this topic.

Offline Marmar

  • In the Band
  • ***
  • Posts: 5036
  • Karma: 515
  • Gender: Male
  • Meet animals laminate 'em
ffmpeg guru's
« on: February 06, 2021, 10:41:36 AM »
Anyone here really good with ffmpeg command line use?

me? not so much. I've looked at the online help and it just doesn't seem to cover what I am looking to do with ffmpeg. I don't know if handbrake can do what I need done, so that's why I am going with ffmpeg because it *seems* like this would be the tool to use....

I need to just add 2 audio tracks to a video file. One being 2ch FLAC 16/48 the other being 5.1 AC3.....I can probably do it in an NLE, but I would rather just assemble my TIFF images into a video file, then add the untouched audio tracks to that file.

Anyone willing to help learn me how?
Who's the Marmar? I'm the Marmar!!!

If John Medeski was my church organist I would NEVER miss a Sunday....

Phish doesn't write beautiful music...the beautiful music happens after the written parts.

"If you don't like what you're doing, you can always pick up your needle and move to another groove." - Dr. Timothy Leary

<gainesvillegreen> now, if they could get their sound to be as good as the lights, we'd have a band hee-yah!!

Music is what feelings sound like.

Offline kellerb

  • In the Band
  • ***
  • Posts: 9848
  • Karma: 774
  • Gender: Male
  • YEMLESS
Re: ffmpeg guru's
« Reply #1 on: February 06, 2021, 12:27:16 PM »
I think MKVtoolNIXgui would be able to do that relatively easy?

Offline Marmar

  • In the Band
  • ***
  • Posts: 5036
  • Karma: 515
  • Gender: Male
  • Meet animals laminate 'em
Re: ffmpeg guru's
« Reply #2 on: February 06, 2021, 01:28:48 PM »
Who's the Marmar? I'm the Marmar!!!

If John Medeski was my church organist I would NEVER miss a Sunday....

Phish doesn't write beautiful music...the beautiful music happens after the written parts.

"If you don't like what you're doing, you can always pick up your needle and move to another groove." - Dr. Timothy Leary

<gainesvillegreen> now, if they could get their sound to be as good as the lights, we'd have a band hee-yah!!

Music is what feelings sound like.

Offline ph92

  • In the Band
  • ***
  • Posts: 5882
  • Karma: 217
  • Gender: Male
  • bag it, tag it
Re: ffmpeg guru's
« Reply #3 on: February 07, 2021, 07:55:40 PM »
RTFM  :hereitisyousentimentalbastard

I've used it on the command line, and it a bitch to get working right. The syntax is pretty finicky.

https://gist.github.com/protrolium/e0dbd4bb0f1a396fcb55

There's some stuff here that may help you.

Alternatively, the application Handbrake is basically just a GUI/wrapper for ffmpeg/x264/x265 and more. It's got tons of extra features and I'm fairly certain it's extensible. It seems to be the gold standard for encoding, so I'm sure there's a way.... but it is a very steep learning curve with handbreake as well.
« Last Edit: February 08, 2021, 12:27:50 PM by ph92 »
Make America Melt Again!

FUCK YEAH TREY. FUCK YEAH

Offline Marmar

  • In the Band
  • ***
  • Posts: 5036
  • Karma: 515
  • Gender: Male
  • Meet animals laminate 'em
Re: ffmpeg guru's
« Reply #4 on: February 08, 2021, 04:02:39 PM »
RTFM  :hereitisyousentimentalbastard

I've used it on the command line, and it a bitch to get working right. The syntax is pretty finicky.

https://gist.github.com/protrolium/e0dbd4bb0f1a396fcb55

There's some stuff here that may help you.

Alternatively, the application Handbrake is basically just a GUI/wrapper for ffmpeg/x264/x265 and more. It's got tons of extra features and I'm fairly certain it's extensible. It seems to be the gold standard for encoding, so I'm sure there's a way.... but it is a very steep learning curve with handbreake as well.

Literally have not found anything anywhere that explains what I want to do....

Video w/2ch PCM audio
I want to ADD: 5.1ac3 audio as a second audio stream to the existing file....

End Result: Encoded file with 2ch FLAC and 5.1 AC3 as selectable streams

I can do this on a DVD all day....used to do it all the time....but I can not for the life of me figure out how to append a secondary audio stream to an existing file.....
Who's the Marmar? I'm the Marmar!!!

If John Medeski was my church organist I would NEVER miss a Sunday....

Phish doesn't write beautiful music...the beautiful music happens after the written parts.

"If you don't like what you're doing, you can always pick up your needle and move to another groove." - Dr. Timothy Leary

<gainesvillegreen> now, if they could get their sound to be as good as the lights, we'd have a band hee-yah!!

Music is what feelings sound like.

Offline ph92

  • In the Band
  • ***
  • Posts: 5882
  • Karma: 217
  • Gender: Male
  • bag it, tag it
Re: ffmpeg guru's
« Reply #5 on: February 08, 2021, 09:11:02 PM »
https://linux.die.net/man/1/ffmpeg

Quote
-newaudio
Add a new audio track to the output file. If you want to specify parameters, do so before "-newaudio" ("-acodec", "-ab", etc..).
Mapping will be done automatically, if the number of output streams is equal to the number of input streams, else it will pick the first one that matches. You can override the mapping using "-map" as usual.

Example:

ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio

Maybe?


When it comes to these kind of apps, just copy a small section of your video and just start trying things out. That way you don't have to wait for the whole damn video to do it's thing. Just some testing on a small sample video/audio.

When I'm scripting and writing small programs, it takes TONS of testing to get it right. Just start trying some shit and see what happens.
« Last Edit: February 08, 2021, 09:12:39 PM by ph92 »
Make America Melt Again!

FUCK YEAH TREY. FUCK YEAH

Offline Marmar

  • In the Band
  • ***
  • Posts: 5036
  • Karma: 515
  • Gender: Male
  • Meet animals laminate 'em
Re: ffmpeg guru's
« Reply #6 on: February 14, 2021, 10:16:29 AM »
found it.

if anyone needs this feature here is the command line:

ffmpeg -i video.avi -i audio1.mp3 -i audio2.mp3 -map 0 -map 1 -map 2 -codec copy output

That command allows you to have 2 audio streams (2ch and 5.1 for example) mapped to one video file. PERFECT for copying SD DVD's to HD mkv files with flac and ac3/dts audio tracks.
Who's the Marmar? I'm the Marmar!!!

If John Medeski was my church organist I would NEVER miss a Sunday....

Phish doesn't write beautiful music...the beautiful music happens after the written parts.

"If you don't like what you're doing, you can always pick up your needle and move to another groove." - Dr. Timothy Leary

<gainesvillegreen> now, if they could get their sound to be as good as the lights, we'd have a band hee-yah!!

Music is what feelings sound like.

Offline ph92

  • In the Band
  • ***
  • Posts: 5882
  • Karma: 217
  • Gender: Male
  • bag it, tag it
Re: ffmpeg guru's
« Reply #7 on: February 14, 2021, 12:29:18 PM »
found it.

if anyone needs this feature here is the command line:

ffmpeg -i video.avi -i audio1.mp3 -i audio2.mp3 -map 0 -map 1 -map 2 -codec copy output

That command allows you to have 2 audio streams (2ch and 5.1 for example) mapped to one video file. PERFECT for copying SD DVD's to HD mkv files with flac and ac3/dts audio tracks.
Glad you got it! Now make it a little shell script that takes arguments and it'll be portable!

I did also see that you can add offsets to the audio streams individually if needed
Make America Melt Again!

FUCK YEAH TREY. FUCK YEAH