View previous topic :: View next topic |
Author |
Message |
sdauth l33t
Joined: 19 Sep 2018 Posts: 643 Location: Ásgarðr
|
Posted: Wed Jan 10, 2024 12:32 pm Post subject: vob files demuxer |
|
|
Hello,
Do you know an easy way to demux all tracks (video, audio, subtitles) from a bunch of VOB files ?
I know it is possible using mencoder or ffmpeg but one needs to manually input the stream id, what I want is to dump the whole thing in one command.
Right now I'm using makemkv to... make a mkv from the VOB, then I demux the mkv with mkvextract (from mkvtoolnix) to get the tracks separately but there must be a quicker way.
Thanks
Last edited by sdauth on Wed Feb 07, 2024 10:46 pm; edited 1 time in total |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31255 Location: here
|
Posted: Wed Jan 10, 2024 12:37 pm Post subject: |
|
|
Maybe media-video/handbrake can do it. _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
sdauth l33t
Joined: 19 Sep 2018 Posts: 643 Location: Ásgarðr
|
Posted: Wed Jan 10, 2024 6:06 pm Post subject: |
|
|
Unless it recently changed, you can't copy the video (lossless) with handbrake, and it will produce a mp4/mkv anyway.
My current workflow :
With makemkv (cli), I load the vob files and generate a mkv :
Code: | makemkvcon mkv file:MOVIE/VIDEO_TS 0 . |
Then I use this nice python script : https://github.com/dropcreations/mkvextractor
and select option 1 to extract all tracks from the mkv.
It works, but I would like to do it in a single operation and avoid useless writes. |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 425 Location: Naarm/Melbourne, Australia
|
Posted: Thu Jan 11, 2024 11:34 am Post subject: |
|
|
i've been nerd-sniped. i've been trying to learn ffmpeg recently, so ....
This is, obviously, very far from being a one-liner, and is clearly limited; but it's POSIX other than its use of ffmpeg(1) and ffprobe(1), and only invokes ffmpeg once.
Code: | extract_streams () {
V_EXT='mp4'
A_EXT='mp3'
FILE="${1}"
CMD="ffmpeg -i ${FILE}"
STREAMS=$(
ffprobe "${FILE}" 2>&1 | \
sed -n 's/^.*Stream #\([^[]*\)[^:]*: \([^:]*\):.*$/\1=\2/p; ' | \
tr '\n' ' '
)
for S in $STREAMS
do
OUT=
EXT=
case "${S}" in
*Video)
EXT=${V_EXT}
;;
*Audio)
EXT=${A_EXT}
;;
esac
if [ -n "${EXT}" ]
then
I=${S}
I=${I%%=Video}
I=${I%%=Audio}
N=$(echo $I | awk -F: '{ print $2 }')
OUT="stream-${N}.${EXT}"
CMD="${CMD} -map ${I} ${OUT}"
fi
done
echo "Running: $CMD"
${CMD}
} |
|
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 425 Location: Naarm/Melbourne, Australia
|
Posted: Thu Jan 11, 2024 11:44 am Post subject: |
|
|
Oh, i meant to say, you specifically asked for the subtitles to be extracted as well, but i wasn't sure whether what ffprobe(1) reports as a 'Data' stream - as distinct from 'Video' or 'Audio' - is where the subtitles are? In any case, hopefully my function gives you a base to build on (assuming someone else doesn't provide a far more elegant solution). |
|
Back to top |
|
|
yayo Tux's lil' helper
Joined: 19 May 2014 Posts: 99
|
Posted: Fri Jan 19, 2024 6:02 pm Post subject: |
|
|
This page suggests to use some extra options ( -analyzeduration # -probesize # ) while looking for streams in a vob file with ffmpeg (see step 2):
https://www.internalpointers.com/post/convert-vob-files-mkv-ffmpeg
That's because vob files have no headers, so you must force ffmpeg to search for data streams "manually". |
|
Back to top |
|
|
Dragonix Apprentice
Joined: 21 May 2006 Posts: 253 Location: Germany
|
|
Back to top |
|
|
downloader n00b
Joined: 09 Mar 2024 Posts: 4
|
Posted: Sat Mar 09, 2024 9:03 pm Post subject: Help With Surf Browser Youtube Playback |
|
|
To demux all tracks (video, audio, subtitles) from a batch of VOB files using FFmpeg, you can employ a straightforward command:
Code: | ffmpeg -i input.vob -map 0 -c copy output.mkv
|
This command remuxes the VOB files into a Matroska (MKV) container, preserving all tracks without any transcoding. The -map 0 option selects all streams from the input file, and -c copy copies them into the output MKV file without re-encoding.
Alternatively, if you prefer to demux directly from the VOB files without creating an intermediate MKV file, you can use:
Code: | ffmpeg -i input.vob -c copy -map 0:v:0 video_track.vob -map 0:a audio_track.ac3 -map 0:s subtitle_track.sub
|
In this command:
-map 0:v:0 selects the first video stream.
-map 0:a selects all audio streams.
-map 0:s selects all subtitle streams.
Replace input.vob with your VOB file's name and adjust the output file names (video_track.vob, audio_track.ac3, subtitle_track.sub) as needed.
These commands enable you to quickly demux all tracks from your VOB files with a single command. Let me know if you need further assistance! |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 425 Location: Naarm/Melbourne, Australia
|
Posted: Sun Mar 10, 2024 1:25 am Post subject: |
|
|
@downloader: In the first post, the OP wrote:
Quote: | I know it is possible using mencoder or ffmpeg but one needs to manually input the stream id |
which i take as implying that the OP doesn't want to have to manually specify each of the streams and each distinct file those streams should be placed in. Hence the script i provided; whereas the second command you provided, to extract individual streams into distinct files, doesn't seem to avoid having to manually specify the stream to be extracted. Am i missing or misunderstanding either you or the OP? |
|
Back to top |
|
|
downloader n00b
Joined: 09 Mar 2024 Posts: 4
|
Posted: Tue Mar 12, 2024 9:05 am Post subject: |
|
|
flexibeast wrote: | @downloader: In the first post, the OP wrote:
Quote: | I know it is possible using mencoder or ffmpeg but one needs to manually input the stream id |
which i take as implying that the OP doesn't want to have to manually specify each of the streams and each distinct file those streams should be placed in. Hence the script i provided; whereas the second command you provided, to extract individual streams into distinct files, doesn't seem to avoid having to manually specify the stream to be extracted. Am i missing or misunderstanding either you or the OP? |
The script you provided automates the extraction of all streams from the input file without requiring manual specification of each stream ID. On the other hand, the second command I suggested allows for the extraction of specific streams into separate files but necessitates manual input of the stream ID for each extraction. Both approaches offer solutions to the OP's query, with your script providing a more automated process and the second command allowing for more granular control over stream extraction. The choice between the two methods depends on the OP's preference regarding automation and the desired output format. |
|
Back to top |
|
|
|