2

I read that it is better to extract from vob H264 files within a .ts to have a lossless and more accurate sample, easy to cut, is that correct ?

I used these commands :

ffmpeg -i VTS_01_1.VOB  -acodec libfaac -aq 100 -ac 2 -vol 2048 -vcodec libx264 -preset veryslow -crf 18 -threads 2 manu1.mp4

ffmpeg -i manu1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

I did extract two video samples from the intermediate .ts file with that kind of command :

ffmpeg -ss 43 -i intermediate1.ts -vcodec copy -vframes 1400 -acodec copy 1-manubus.ts

if I play separately this .ts files in vlc, they are both completely decoded, no frames are missing

Finalization :

ffmpeg -analyzeduration 200M -probesize 150M -i "concat:1-manubus.ts|2-manuchoisit.ts" -c:v libx264 -crf 18 -preset slow -bsf:a aac_adtstoasc -force_key_frames 0 1990-Manu_Redpants.mp4 

But then, When I play the final file, the first 6 sec are a frozen frame and then comes the audio and video streams perfectly synchro until the end. If I play the first part 1-manubus.ts, the 6 first seconds exists and are not missing, what's happening ? Something related to first frame not being the I-frames ?

1
  • Please include the complete console output from each command.
    – llogan
    Jun 3, 2015 at 19:07

2 Answers 2

2

In the first step you are doing a lossy conversion, you transcode from vob to mp4, and then to ts. For a lossless re-mux you should just re-mux, better to specify both video and audio:

ffmpeg -i VTS_01_1.VOB -c:v copy -c:a copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

However, if you re-mux for the purpose of slicing then you should be aware that with this method it is possible only on exact keyframe boundary, so you might want to reconsider whether you want to do it this way. For a detailed explanation please see in this answer.

4
  • After reading your interesting article link, and as I want to precisely cut the extracts, my understanding is that I should have placed -ss after the -i input_file.mp4, and this will be particulary slow, do you confirm ?
    – Manuhoz
    Jun 4, 2015 at 12:52
  • Yes, transcoding requires more time and also some quality loss, but gives you better control on the result. If you want a precise cut you should operate on the original VOB file, placing the -ss and -t before the output file (in your case it looks the same as placing after the input file, but to be precise we want the skipping to be done while producing the output). You should generate TS files, so that you don't transcode during concatenation. Once you have all you segments you can merge them and mux the merged movie into the final mp4 without any additional transcoding.
    – avnr
    Jun 4, 2015 at 13:01
  • You'll get better results (avoiding timestamp / av-sync glitches) by using DVD tools to get a .ts from a collection of .VOB/.IFO files. Like mplayer -dumpfile title1.ts -dvd-device /path/to/the/dir dvd://1 I think. I forget what command I used to use for this. >.< Jun 5, 2015 at 19:22
  • I found the command I've used before for dumping a .ts for a DVD title: tccat, from the transcode package. Should be equivalent to anything else that knows about dvd structures, and isn't just accessing the VOBs directly. Jun 5, 2015 at 21:03
2

I finally made it work in splicing directly the VOB files with the commands below :

ffmpeg -i VTS_01_2.VOB -ss 463 -c copy -vframes 325 2-manuchoisit.vob

ffmpeg -i VTS_01_2.VOB -ss 353 -t 16 -c copy 3-manutombe.vob

and then concat the extracts and convert with

ffmpeg -analyzeduration 200M -probesize 150M -i "concat:1-manubus.vob|2-manuchoisit.vob|3-manutombe.vob" -vcodec libx264 -preset veryslow -crf 18 -acodec libfaac -aq 100 -ac 2 -vol 2048 1990-Manu_Redpants.mp4

No frames lost, precise cuts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.