Can you change the duration of a video in Handbrake?
Yes, you can select the desired length by chapters, time or even frames.
BUT this only works properly when Audio and Video have the same length (video is always cutted correctly, audio not).
So you have to either 
1. cut the audio track with Audacity or any DAW (Tracktion is really good and free) to the correct length and mux it back together afterwards (Yamb for MP4, MKVToolnix for MKV) or you can 
2.add a chapter mark at the end of your video and put the video into fre:ac (the best audio converter I know), check "encode to a single file" and unselect the last of the appearing titles (everything after your chapter mark). Now you can convert your audio into anything you want. fre:ac only detects mp4 chapters, you can edit/add them with Drax and you have to use fre:ac alpha version to use this feature.