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

Nick Rout nick.rout at gmail.com
Mon Jul 19 05:41:27 BST 2010


On Mon, Jul 19, 2010 at 12:17 AM, Craig Blaikie <craig at gregor.co.nz> wrote:
> 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
>
>
> David Moore wrote
>>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.
>
> You could try using vlc, as I found it was able to play the recorded video
> files with sound, use it to convert the audio to mp4a and then use ffmpeg to
> do the cutting or compression, I know it's an extra step, and you end
> needing free space to have an almost identical copy of the file there, but
> it seems to work, and the audio appears to stay in sync. I couldn't get VLC
> to cut and convert the video without totally messing it up, hence the extra
> ffmpeg step.
>
> Use command line version of VLC to copy video and transcode audio.
>
> nice -n 15 cvlc input_filename.mpg --sout="#transcode{acodec=mp4a, ab=192,
> channels=2, samplerate=48000}:standard{mux=ts, dst=temp_filename.mp4,
> access=file}:sout-transcode-soverlay=0" vlc://quit
>
> then use ffmpeg to cut, or in this example, convert to iPod.
>
> nice -n 15 ffmpeg -i temp_filename.mp4 -vcodec libxvid -b 512kb -qmin 3
> -qmax 5 -bufsize 4096 -g 300 -acodec libfaac -ab 192kb -s 736x416 -aspect
> 16:9 output_filename.mp4

Has anyone tried SmartLabs tsMuxeR? It seems to be designed for these
types of files, but it seems to only be able to do a single cut (ie a
start and end cut, meaning you only get one chunk of the file.) (at
least in the windows gui version).

But I guess a script could  run over the file several times, cutting
out each "non advert bit" and then stitch them back together.

Can anyone point me to a suitable file to try it out on?



More information about the mythtvnz mailing list