[mythtvnz] Cutting H.264 DVB-T files with ffmpeg without transcoding

David Moore dmoo1790 at ihug.co.nz
Sun Jul 18 04:19:02 BST 2010


Jonathan Hoskin wrote:
>     Anybody worked out a reliable way to cut recordings from Freeview
>     terrestrial using ffmpeg?
> 
>  
> Nope. I wonder if the developers have properly addressed it / been made 
> aware of it.
> 
> 

I've seen a lot of posts from (I think) ffmpeg devs on various lists 
which seem to say "too bad, it's the recording that's bad, not a bug in 
ffmpeg".

>     ffmpeg -async 1 -ss [start time] -t [duration] -i recording.mpg -vcodec
> 
>     copy -acodec ac3 -ab 384k -f dvd cut_recording.mpg
> 
>     The "-async 1" seems to be needed to keep audio in sync with video. The
>     "-f dvd" might (not sure yet) be a fix for av mux errors. Audio is
>     transcoded to AC3 since most channels only have LATM AAC audio.
> 
> 
> "-f dvd" uses a MPEG2-PS container - H.264 isn't supported in the 
> MPEG-PS file format:
> http://www.gossamer-threads.com/lists/mythtv/mythtvnz/417130#417130
>  
> 

Thanks for that. I have tried MPEG-TS format as well but also with no 
joy. Latest semi-successful attempts have involved extracting the video 
to raw H264 format and transcoding the audio to raw AC3 then remuxing to 
mpg (without the -f dvd option). Unfortunately I get audio/video sync 
problems now. I don't see how I can easily resolve this because (I 
assume) the raw formats have no timestamps or have timestamps which are 
slightly out of sync.

Seems that timestamps may be the root of the problem because I was 
previously getting the ffmpeg "non-monotone timestamp" error and weird 
start times reported by ffmpeg. I have no idea how to fix this without a 
lot of manual audio/video syncing. I wonder how myth copes with the same 
recordings when ffmpeg has problems? Might have to dig into the myth and 
ffmpeg source code to try and find the differences.



More information about the mythtvnz mailing list