How do you select to copy video?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
VA1DER
Posts: 2
Joined: Tue Apr 21, 2020 10:44 pm

How do you select to copy video?

Post by VA1DER »

Some conversions are audio-only, or of container formats where decoding/re-encoding is not necessary. I can't see where to select to copy video rather than transcode. Is this possible with Handbrake?
mduell
Veteran User
Posts: 8206
Joined: Sat Apr 21, 2007 8:54 pm

Re: How do you select to copy video?

Post by mduell »

HB is a video transcoder; video is always decoded and encoded.

If you want a more generic muxer, there are plenty available. Generalists like ffmpeg, and specialists like mp4box and mkvmerge.
VA1DER
Posts: 2
Joined: Tue Apr 21, 2020 10:44 pm

Re: How do you select to copy video?

Post by VA1DER »

I find this unfortunate. It is otherwise an amazing program. Audio appears to have a copy (passthru) capability, so I'm not sure why video is left out of this. In any case, call it a feature request.

Handbrake is in various places listed as a front end for ffmpeg, I'm not sure if this is still the case. Whatever the current back end is, it is surely capable of non-transcoding video copying, and there are lots of valid cases for where this would be valuable. It certainly couldn't hurt (and nor would it be difficult) to add a "Copy" to the video. Call it a feature request. Would a patch adding this ability be likely to be accepted?
Woodstock
Veteran User
Posts: 4623
Joined: Tue Aug 27, 2013 6:39 am

Re: How do you select to copy video?

Post by Woodstock »

Because it's a video encoder.

Anyone who thinks handbrake is a front end for ffmpeg has never used handbrake. Handbrake uses parts of the ffmpeg library. Kind of like saying a Jeep is nothing but a front end for gasoline.
mduell
Veteran User
Posts: 8206
Joined: Sat Apr 21, 2007 8:54 pm

Re: How do you select to copy video?

Post by mduell »

VA1DER wrote: Wed Apr 22, 2020 1:10 amHandbrake is in various places listed as a front end for ffmpeg
It is not.
VA1DER wrote: Wed Apr 22, 2020 1:10 amWhatever the current back end is, it is surely capable of non-transcoding video copying
It is not. It was architected for video encoding.
VA1DER wrote: Wed Apr 22, 2020 1:10 amIt certainly couldn't hurt (and nor would it be difficult) to add a "Copy" to the video.
It would, while maintaining all of the other capabilities of HB.
VA1DER wrote: Wed Apr 22, 2020 1:10 amWould a patch adding this ability be likely to be accepted?
Unlikely, as anyone capable of writing it would understand why it's not suited to HandBrake's architecture.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: How do you select to copy video?

Post by JohnAStebbins »

Handbrake is in various places listed as a front end for ffmpeg, I'm not sure if this is still the case.
HandBrake was originally designed for BeOS. It originally use libavcodec (one of ffmpeg's libraries) for mpeg2 decoding and mpeg4 encoding only. Some additional history is in our docs. Over time, we have used more of ffmpeg's libraries for demux, decode, filtering, encoding and muxing of other formats and codecs. HandBrake does not and has never used the ffmpeg executable.

The reason HandBrake does not do video passthrough is related to how synchronization is handled. HandBrake makes sure the timestamps in every stream are continuous and align properly. If you've used ffmpeg much for remuxing, I'm sure you've seen this message,

Code: Select all

Non-monotonous DTS in output stream 0:0; previous: 4537530, current: 4534560; changing to 4537531. This may result in incorrect timestamps in the output file.
This is what we fix in HandBrakes' synchronization code. This is required by the mp4 container due to how it represents timestamps and is helpful in other containers to ensure proper playback. In order to accomplish this, HandBrake must be able to drop/duplicate frames, or shorten/extend the duration of individual frames. Audio frames are independent (you don't require previous or latter frames to decode the current frame). So you can drop a frame or insert a silent frame as needed to adjust timestamp alignment. Video frames are not independent. You can not drop a coded frame without corrupting several frames surrounding it. You can not insert a frame. The only thing you can do with video is shift it's timestamp which is often not sufficient.

So in order to do video passthrough we would have to add a warning that the resulting output file may not play or may play incorrectly after it's been remuxed. In general, we've been shooting for an "it just works" experience for users. I can't say we've accomplished that in all cases :mrgreen: but it's a nice goal. We are not keen on adding features that knowingly go against this.
Deleted User 11865

Re: How do you select to copy video?

Post by Deleted User 11865 »

JohnAStebbins wrote: Wed Apr 22, 2020 2:35 pm
Handbrake is in various places listed as a front end for ffmpeg, I'm not sure if this is still the case.
HandBrake was originally designed for BeOS. It originally use libavcodec (one of ffmpeg's libraries) for mpeg2 decoding and mpeg4 encoding only.
Actually we used another library for MPEG-2 video decoding originally ;) :P

Did HandBrake use avcodec at all until Van implemented it (IIRC somewhere in the 0.9.x run)?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: How do you select to copy video?

Post by JohnAStebbins »

Did HandBrake use avcodec at all until Van implemented it (IIRC somewhere in the 0.9.x run)?
First entry in git is for v0.1 which is using libav for mpeg4 encode. You are correct, it's using libmpeg2 for mpeg2 decode, I didn't look close enough at the decode code. The decoder is using avpicture_deinterlace from libav, so is including avcodec headers which threw me off.
rollin_eng
Veteran User
Posts: 4859
Joined: Wed May 04, 2011 11:06 pm

Re: How do you select to copy video?

Post by rollin_eng »

That JohnAStebbins, he don’t know nuffink :wink:
Deleted User 11865

Re: How do you select to copy video?

Post by Deleted User 11865 »

Ironically, John is the one who switched HandBrake to use libavcodec's MPEG-2 decoder for all streams (though we did use it for avformat-demuxed streams a fair bit earlier).
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: How do you select to copy video?

Post by JohnAStebbins »

Must be getting senile :?
Deleted User 13735

Re: How do you select to copy video?

Post by Deleted User 13735 »

If you're on Windows, VideoRedo 6 is my go-to solution for muxing, smart copy, and TS cleansing. There is a free trial. I have no interest other than as a user.
Deleted User 11865

Re: How do you select to copy video?

Post by Deleted User 11865 »

JohnAStebbins wrote: Wed Apr 22, 2020 8:10 pm Must be getting senile :?
I know you, you're not that old :D
Post Reply