JP Vossen via plug on 30 Aug 2020 18:32:25 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Transcoding MTS vids to something else for frame extraction


Typo in subject fixed, sigh.

Thanks Keith, I figured you'd have thoughts. Unfortunately, mjpeg was a bit worse, as least after using these then re-extracting:
	ffmpeg -i 00023.MTS 00023.mjpeg
	ffmpeg -i 00023.MTS -b:v 10000k 00023.mjpeg

`ffmpeg -i 00023.MTS 00023.avi` resulted in less interlaced pictures (I think?), but they were very pixelated and fuzzy.

`ffmpeg -i 00023.MTS 00023.mp4` was much slower than the others and the frames where as bad or worse than the MTS.

Interestingly, all the transcoded formats above were about half the size of the original MTS, which I did not expect. Perhaps some `ffmpeg` default is at work there?


This was a bit better, and the output file was larger than the input, which I'd expect. But most frames were still interlaced or just off:
	ffmpeg -i 00023.MTS -c:v libxvid -qscale:v 2 00023.avi

I tried to combine things, but this was no better than previous:
	ffmpeg -hide_banner -i 00023.MTS -acodec copy -vcodec rawvideo \
		-y -force_key_frames 'expr:gte(t,n_forced*5)' 00023.avi

I ended up doing this, then extracting the frames again, but I'm not sure it was really much better:
```
for file in *.MTS; do
    ffmpeg -hide_banner -loglevel error -nostdin -i $file -acodec copy \
        -vcodec rawvideo -y /tmp/dolphins/"${file//MTS/avi}"
done
```

When I say "interlaced" frames, I mean there are sometimes fuzzy ghost images and/or bars and spaces in things, mostly things in motion. I was assuming that was artifacts from the keyframe and diff thing, but...maybe that's just how this camera works? Nothing I do seems to improve it, at any rate.


On 8/30/20 3:42 PM, Keith C. Perry wrote:
Try going to mjpeg first at the same quality. That format is usually best for intermittent work and for pulling stills out.

On August 30, 2020 3:03:49 PM EDT, JP Vossen via plug <plug@lists.phillylinux.org> wrote:

    My wife has some MTS videos we took on vacation from which we want to
    extract some frames.  No problem:
    ```
    ffmpeg -hide_banner -loglevel error -nostdin \
       -i $file -ss $start -to $stop -r $fps $dir/$output_file-$loop-%06d.$ext
    ```

    But most of the resulting frames are fuzzy or interlaced, presumably
    because MTS (about which I know nothing) uses a key frame and then diffs
    (whatever that's called).  Note I got the same results using `-r 30` and
    `-r 5`.

    I was thinking that I could transcode MTS to something better (read
    much, much larger), then extract the frames I want from that.  I know
    the answer is also `ffmpeg` but...with what settings?
Later,
JP
--  -------------------------------------------------------------------
JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug