Best syntax for camcorder videos for video editing?

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Best syntax for camcorder videos for video editing?

Post by linuxuser »

I would like to prepare a camcorder-dv-file for video-editing and "adjust" a few things before I load the file into a movie editor. Mainly I like decomb to deinterlace and I would like to remove these aspect-ratio things, mainly PAR and use square pixels. Filesize doesn't count.

So please help me to improve this command, to get the best quality possible.

Code: Select all

HandBrakeCLI -i dvtest.avi -C 1 -e x264 -q 16 -a 1 -E lame -B 320 -R 44.1 -D 0.0,0.0 -f mp4 --decomb --loose-anamorphic -m -x b-adapt=2:rc-lookahead=50  -o movie.mp4
--loose-anamorphic is a placeholder, since I know a better solution.

-C 1: creates maybe a better quality, if 1 CPU is used. Since there are thousands of small files, multi-threading is not an advantage, since I can run 2 files with 1 CPU at the same time, maybe the cpu is better used then too

-e x264: my codec taste ;-)

-q 16: as said, quality counts, size not and the file will be used in a movie editor and be calculated again

-a 1: 1 Audio stream is enough, but I don't know how I can select the better audio stream. Please see at the end. Does the dv-file contain the audio 2x with the same quality?

-E lame -B 320: don't know if there is an option for a better quality? I didn't find out if flac can be used

-R 44.1: I would like to mix the camcorder-sound with mp3s, so I upsample the camcorder sound to 44.1

-D 0.0,0.0: no crop, but maybe used with 4:3 videos

-f mp4: I think it is not important if mp4 or mkv is used. I use mp4, because the result will be in mkv, so I can see easily that mp4 is an input file

--decomb: I think the best way to deinterlace dv-files?

--loose-anamorphi: I am very unsure, what to use here and I think I want to have anamorphic off and PAR=1

-m: I think not necessary, since markers are not used, but not wrong too

-x b-adapt=2:rc-lookahead=50: default of the high profile, improvements for dv are welcome.


With the mentioned command line I get a 1.4MB mp4-file from a 14MB dv-file. This is a lot saving, I don't care if the files get larger and the source quality would be (theoretically) better then for video editing.


Code: Select all

mediainfo dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi 
General
Complete name                            : dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
Format_Commercial_IfAny                  : DVCPRO
File size                                : 13.9 MiB
Duration                                 : 4s 40ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 28.9 Mbps
Recorded date                            : 2010-02-16 21:40:15.000

Video
ID                                       : 0
Format                                   : DV
Format_Commercial_IfAny                  : DVCPRO
Duration                                 : 4s 40ms
Bit rate mode                            : Constant
Bit rate                                 : 24.4 Mbps
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Standard                                 : PAL
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 2.357
Stream size                              : 13.9 MiB (100%)
Encoding settings                        : ae mode=full automatic / wb mode=automatic / white balance= / fcm=manual focus

Audio #1
ID                                       : 0-0
Format                                   : PCM
Muxing mode                              : DV
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 4s 40ms
Bit rate mode                            : Constant
Bit rate                                 : 768 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 KHz
Bit depth                                : 12 bits
Stream size                              : 0.00 Byte (0%)

Audio #2
ID                                       : 0-1
Format                                   : PCM
Muxing mode                              : DV
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 4s 40ms
Bit rate mode                            : Constant
Bit rate                                 : 768 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 KHz
Bit depth                                : 12 bits
Stream size                              : 0.00 Byte (0%)
Last edited by Anonymous on Sun Jan 15, 2012 12:40 pm, edited 1 time in total.
Reason: [code] blocks
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

linuxuser wrote:-C 1: creates maybe a better quality, if 1 CPU is used.
Not really. According to Dark_Shikari (lead x264 developer), threads should be useful and the quality hit should be minimal up to height/40 threads (in this case, 576/40 = 14 threads). Though if you have many many files you could also run 14 instances…
linuxuser wrote:-a 1: 1 Audio stream is enough, but I don't know how I can select the better audio stream. Please see at the end. Does the dv-file contain the audio 2x with the same quality?
Judging by the MediaInfo output below, both audio tracks are identical, so it makes no difference which one you pick (1 or 2).
linuxuser wrote:-E lame -B 320: don't know if there is an option for a better quality? I didn't find out if flac can be used
In the nightly build (see the announcement at the top of every subforum). But it can't be muxed in MP4 containers, and I doubt many video editing solutions support either MKV or FLAC.
linuxuser wrote:--decomb: I think the best way to deinterlace dv-files?
The defaults may be a bit weak for fully interlaced material - the nightly builds features new, stronger default settings which should work better.
linuxuser wrote:--loose-anamorphi: I am very unsure, what to use here and I think I want to have anamorphic off and PAR=1
The CLI default is anamorphic off (PAR=1/1). Do not specify any anamorphic option, and specify width and height.
linuxuser wrote:-m: I think not necessary, since markers are not used, but not wrong too
If the source has no chapters, chapter markers will not be added to the output regardless of the option.
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

I tried flac with the GUI and the file woks then with kdenlive, but I didn't find out the syntax for flac. https://trac.handbrake.fr/wiki/CLIGuide doesn't mention it, probably the feature is too new. I use the Ubuntu-Unstable-Repo with HandBrake 4394svn 2011123101

I tried it without --loose-anamorphic and without a dimension, and mediainfo tells me 720x576, while vlc plays it with 1024x576, I guess.

I tried it with -w 1024 -l 576 and I get 1024x816.

What I am doing wrong?

Which options do you recommend for decomb and how is the syntax?
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

linuxuser wrote:I tried flac with the GUI and the file woks then with kdenlive, but I didn't find out the syntax for flac. https://trac.handbrake.fr/wiki/CLIGuide doesn't mention it, probably the feature is too new.
The encoder name is ffflac (see HandBrakeCLI --help).
linuxuser wrote:I use the Ubuntu-Unstable-Repo with HandBrake 4394svn 2011123101
Don't know what the Ubuntu-Unsatble repo is, but unofficial builds are not supported. You can find official Ubuntu nightlies on LaunchPad:

https://build.handbrake.fr/job/Ubuntu/
https://launchpad.net/~stebbins/+archiv ... -snapshots
linuxuser wrote:I tried it without --loose-anamorphic and without a dimension, and mediainfo tells me 720x576, while vlc plays it with 1024x576, I guess.

I tried it with -w 1024 -l 576 and I get 1024x816.

What I am doing wrong?
Full CLI command + Activity Log please (with the CLI, that would be the stderr output).
linuxuser wrote:Which options do you recommend for decomb and how is the syntax?
The defaults (just --decomb), as of the nightly builds.
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

In this case I use:

Code: Select all

cat /etc/apt/sources.list.d/handbrake_snapshot.list
deb http://ppa.launchpad.net/stebbins/handbrake-snapshots/ubuntu oneiric main
But I use the Packman-Version with Opensuse too.

I changed the syntax a little bit, and today it worked, so I guess, it depends which options are first.

Code: Select all

HandBrakeCLI -i dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi -C 1 -e x264 -w 1024 -l 576 -q 12 -a 1 -E ffflac -R 44.1 -D 0.0,0.0 -f mkv --decomb -m -x b-adapt=2:rc-lookahead=50  -o movie.mkv
In the meantime I read
http://comments.gmane.org/gmane.comp.vi ... evel/58452
H.264's quantization parameter (QP) is on a logarithmic scale.
The mapping is approximately H264QP = 12 + 6*log2(MPEGQP).
For example, MPEG at QP=2 is equivalent to H.264 at QP=18.
+Generally, this option should be avoided and crf should be used instead.

So I guess, crf=12 should be a good approach to lossless. I am not talking of a visible difference compared to higher crf, but of a base for a video editor. In a video editor like kdenlive or openshot filters are used, which are not available in handbrake, on the other side, the video editor doesn't offer filters like decomb.

I post the complete log below, because maybe you see something, that I don't recognize as problem.

Code: Select all

[11:57:56] hb_init: starting libhb thread
HandBrake svn4394 (2011123101) - Linux x86_64 - http://handbrake.fr
2 CPUs detected
Opening dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi...
[11:57:56] hb_scan: path=dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi/BDMV/index.bdmv
libbluray/bluray.c:1471: nav_get_title_list(dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi) failed (0x2396b30)
[11:57:56] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:57:56] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from 'dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi':
  Duration: 00:00:04.04, start: 0.000000, bitrate: 30848 kb/s
    Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 64:45 DAR 16:9, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
    Stream #0.2: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
[11:57:56] No channel layout reported by Libav; guessing one from channel count.
[11:57:56] No channel layout reported by Libav; guessing one from channel count.
[11:57:56] scan: decoding previews for title 1
[11:57:56] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 64:45
[11:57:56] scan: title (0) job->width:720, job->height:400
[11:57:56] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi
  + duration: 00:00:04
  + size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:04
  + audio tracks:
    + 1, Unknown (pcm_s16le) (2.0 ch) (iso639-2: und)
    + 2, Unknown (pcm_s16le) (2.0 ch) (iso639-2: und)
  + subtitle tracks:
[11:57:56] 1 job(s) to process
[11:57:56] starting job
[11:57:56] work: mixdown not specified, track 1 setting mixdown Stereo
[11:57:56] sync: expecting 126 video frames
[11:57:56] work: only 1 chapter, disabling chapter markers
[11:57:56] job configuration:
[11:57:56]  * source
[11:57:56]    + dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi
[11:57:56]    + title 1, chapter(s) 1 to 1
[11:57:56]    + container: avi
[11:57:56]    + data rate: 30848 kbps
[11:57:56]  * destination
[11:57:56]    + movie.mkv
[11:57:56]    + container: Matroska (.mkv)
[11:57:56]  * video track
[11:57:56]    + decoder: dvvideo
[11:57:56]      + bitrate 28800 kbps
[11:57:56]    + frame rate: same as source (around 25.000 fps)
[11:57:56]    + dimensions: 720 * 576 -> 1024 * 576, crop 0/0/0/0, mod 0
[11:57:56]    + filter
[11:57:56]      + Decomb (default settings)
[11:57:56]    + encoder: H.264 (x264)
[11:57:56]      + options: b-adapt=2:rc-lookahead=50
[11:57:56]      + quality: 12.00 (RF)
[11:57:56]  * audio track 1
[11:57:56]    + decoder: Unknown (pcm_s16le) (2.0 ch) (track 1, id 0x1)
[11:57:56]    + mixdown: Stereo
[11:57:56]    + encoder: FLAC (ffmpeg)
[11:57:56]      + samplerate: 44100 Hz
[11:57:56]      + compression level: 1.00
[11:57:56] reader: first SCR 0 id 0x0 DTS 0
[11:57:56] encx264: Encoding at constant RF 12.000000
x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
[11:57:56] decomb thread started for segment 1
[11:57:56] decomb thread started for segment 0
[11:57:56] yadif thread started for segment 1
[11:57:56] yadif thread started for segment 0
x264 [info]: profile High, level 3.1
Encoding: task 1 of 1, 43.65 %[11:57:57] reader: done. 1 scr changes
Encoding: task 1 of 1, 79.37 %[11:58:07] work: average encoding speed for job is 0.000000 fps
Encoding: task 1 of 1, 79.37 %[11:58:07] sync: got 101 frames, 126 expected
[11:58:08] dvvideo-decoder done: 101 frames, 0 decoder errors, 0 drops
[11:58:08] render: lost time: 0 (0 frames)
[11:58:08] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:1     Avg QP:11.90  size: 79792  PSNR Mean Y:51.34 U:52.63 V:52.46 Avg:51.71 Global:51.71
x264 [info]: frame P:26    Avg QP:12.02  size: 75621  PSNR Mean Y:50.67 U:52.12 V:52.05 Avg:51.09 Global:51.06
x264 [info]: frame B:73    Avg QP:13.26  size: 44780  PSNR Mean Y:48.87 U:50.55 V:50.45 Avg:49.35 Global:49.32
x264 [info]: consecutive B-frames:  1.0%  0.0% 15.0% 84.0%
x264 [info]: mb I  I16..4:  1.9% 93.5%  4.6%
x264 [info]: mb P  I16..4:  1.0% 66.2%  1.8%  P16..4:  7.2% 14.4%  9.5%  0.0%  0.0%    skip: 0.0%
x264 [info]: mb B  I16..4:  0.2% 23.5%  0.2%  B16..8: 21.7% 13.4%  5.8%  direct:28.5%  skip: 6.8%  L0:28.2% L1:24.4% BI:47.3%
x264 [info]: 8x8 transform intra:97.1% inter:57.1%
x264 [info]: coded y,uvDC,uvAC intra: 99.6% 100.0% 99.8% inter: 78.1% 87.3% 57.7%
x264 [info]: i16 v,h,dc,p:  1%  4%  5% 91%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 19% 42%  4%  5%  4%  6%  4%  8%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 16% 21%  8% 12%  8% 10%  7%  9%
x264 [info]: i8c dc,h,v,p: 48% 29% 14%  9%
x264 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x264 [info]: ref P L0: 38.7% 10.6% 35.4% 15.2%
x264 [info]: ref B L0: 83.4% 12.7%  3.9%
x264 [info]: ref B L1: 96.4%  3.6%
x264 [info]: SSIM Mean Y:0.9900823 (20.036db)
x264 [info]: PSNR Mean Y:49.363 U:50.980 V:50.884 Avg:49.824 Global:49.731 kb/s:10629.79
[11:58:08] pcm_s16le-decoder done: 0 frames, 0 decoder errors, 0 drops
[11:58:08] mux: track 0, 100 frames, 5314853 bytes, 10629.71 kbps, fifo 128
[11:58:08] mux: track 1, 154 frames, 441080 bytes, 882.16 kbps, fifo 256
[11:58:08] decomb: deinterlaced 20 | blended 32 | unfiltered 48 | total 100
[11:58:08] libhb: work result = 0
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

This looks fine, though you're setting FLAC compression to 1 (least compression) when it shouldn't make any difference to encoding speed (video encoding would be the bottleneck here), when compared to the default (5).

Also, from this log the video is clearly being converted successfully to 1024x576 square pixels.
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

Thanks a lot for looking into it. How to i get the highest flac compression?

ffflac - c 8 ?

HandBrakeCLI --help is not clear for me. With "-c 8" it is ended immediately.

Code: Select all

HandBrakeCLI -i dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi -C 1 -e x264 -w 1024 -l 576 -q 15 -a 1 -E ffflac -c 8 -R 44.1 -D 0.0,0.0 -f mkv --decomb -m -x b-adapt=2:rc-lookahead=50  -o movie.mkv


[15:17:42] hb_init: starting libhb thread
HandBrake svn4394 (2011123101) - Linux x86_64 - http://handbrake.fr
2 CPUs detected
Opening dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi...
[15:17:42] hb_scan: path=dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi/BDMV/index.bdmv
libbluray/bluray.c:1471: nav_get_title_list(dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi) failed (0x2a4eb30)
[15:17:42] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[15:17:42] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from 'dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi':
  Duration: 00:00:04.04, start: 0.000000, bitrate: 30848 kb/s
    Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 64:45 DAR 16:9, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
    Stream #0.2: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
[15:17:42] No channel layout reported by Libav; guessing one from channel count.
[15:17:42] No channel layout reported by Libav; guessing one from channel count.
[15:17:42] scan: decoding previews for title 1
[15:17:42] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 64:45
[15:17:42] scan: title (0) job->width:720, job->height:400
[15:17:42] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi
  + duration: 00:00:04
  + size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:04
  + audio tracks:
    + 1, Unknown (pcm_s16le) (2.0 ch) (iso639-2: und)
    + 2, Unknown (pcm_s16le) (2.0 ch) (iso639-2: und)
  + subtitle tracks:
[15:17:42] 1 job(s) to process
[15:17:42] starting job
[15:17:42] work: mixdown not specified, track 1 setting mixdown Stereo
Last edited by Anonymous on Sun Jan 15, 2012 12:39 pm, edited 1 time in total.
Reason: [code] blocks
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

Options are case-sensitive…

Note that the default compression level (5) should not introduce any noticeable speed hit, but I haven't tested with 8, 10 (highest compression level that's "FLAC subset compliant") or 12 (highest compression level).
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

Rodeo wrote:Options are case-sensitive….
I know, but now I am confused, probably because of using https://trac.handbrake.fr/wiki/CLIGuide and --help. At https://trac.handbrake.fr/wiki/CLIGuide I see
-C, --cpu Set CPU count (default: autodetected)
If I use --cpu I get: unrecognized option '--cpu'

So I understand, why I get "compression level: 1.00" with -C 1.

So how can I tell handbrake to use 1 cpu only?
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

Oh, right. The --cpu option was removed. If you want x264 to only use 1 thread, you need to add threads=1 to your advanced x264 options (-x).
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

I think finally I have an acceptable solution, which works with kdenlive and openshot. I tested the preview of a very short clip only and I could see an image and hear the sound.

The advantage of using Hanbrake before the video editor is to use --decomb to deinterlace the video, if necessary, without checking if it is interlaced or not and to get square pixels, so there is no need to think about if anything in the queue, normally the TV or media player is distorting the picture, because of a wrong interpretation of PAR.

Code: Select all

HandBrakeCLI -i dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi -e x264 -w 1024 -l 576 -q 12 -a 1 -E ffflac -C 8 -R 44.1 -D 0.0,0.0 -f mkv --decomb -m -x threads=1:b-adapt=2:rc-lookahead=50 -o movie.mkv
Original file size of the camcorder file: 14M
Handbrake-File:5.5M

Interesting is, the filesize is the same without -C 8, that is -C 5, the default compression, maybe because the clip is very short.

Depending on the importance of the sound, lame could be used. With -B 320 the file gets 5.3M, so I think for important personal movies the difference between best lame options and flac doesn't count, on the other hand camcorder sound from the built-in microphone is normally very bad.

Code: Select all

 HandBrakeCLI -i dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi -e x264 -w 1024 -l 576 -q 12 -a 1 -E ffflac -C 8 -R 44.1 -D 0.0,0.0 -f mkv --decomb -m -x threads=1:b-adapt=2:rc-lookahead=50 -o movie.mkv

[16:47:45] hb_init: starting libhb thread
HandBrake svn4394 (2011123101) - Linux x86_64 - http://handbrake.fr
2 CPUs detected
Opening dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi...
[16:47:45] hb_scan: path=dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi/BDMV/index.bdmv
libbluray/bluray.c:1471: nav_get_title_list(dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi) failed (0x2d01b30)
[16:47:45] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[16:47:45] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from 'dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi':
  Duration: 00:00:04.04, start: 0.000000, bitrate: 30848 kb/s
    Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 64:45 DAR 16:9, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
    Stream #0.2: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
[16:47:45] No channel layout reported by Libav; guessing one from channel count.
[16:47:45] No channel layout reported by Libav; guessing one from channel count.
[16:47:45] scan: decoding previews for title 1
[16:47:45] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 64:45
[16:47:45] scan: title (0) job->width:720, job->height:400
[16:47:45] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi
  + duration: 00:00:04
  + size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:04
  + audio tracks:
    + 1, Unknown (pcm_s16le) (2.0 ch) (iso639-2: und)
    + 2, Unknown (pcm_s16le) (2.0 ch) (iso639-2: und)
  + subtitle tracks:
[16:47:45] 1 job(s) to process
[16:47:45] starting job
[16:47:45] work: mixdown not specified, track 1 setting mixdown Stereo
[16:47:45] sync: expecting 126 video frames
[16:47:45] work: only 1 chapter, disabling chapter markers
[16:47:45] job configuration:
[16:47:45]  * source
[16:47:45]    + dvtest_001_20100216214015.000-720x576i-169-25fps-dv1-32khz-4s40ms.avi
[16:47:45]    + title 1, chapter(s) 1 to 1
[16:47:45]    + container: avi
[16:47:45]    + data rate: 30848 kbps
[16:47:45]  * destination
[16:47:45]    + movie.mkv
[16:47:45]    + container: Matroska (.mkv)
[16:47:45]  * video track
[16:47:45]    + decoder: dvvideo
[16:47:45]      + bitrate 28800 kbps
[16:47:45]    + frame rate: same as source (around 25.000 fps)
[16:47:45]    + dimensions: 720 * 576 -> 1024 * 576, crop 0/0/0/0, mod 0
[16:47:45]    + filter
[16:47:45]      + Decomb (default settings)
[16:47:45]    + encoder: H.264 (x264)
[16:47:45]      + options: threads=1:b-adapt=2:rc-lookahead=50
[16:47:45]      + quality: 12.00 (RF)
[16:47:45]  * audio track 1
[16:47:45]    + decoder: Unknown (pcm_s16le) (2.0 ch) (track 1, id 0x1)
[16:47:45]    + mixdown: Stereo
[16:47:45]    + encoder: FLAC (ffmpeg)
[16:47:45]      + samplerate: 44100 Hz
[16:47:45]      + compression level: 8.00
[16:47:45] reader: first SCR 0 id 0x0 DTS 0
[16:47:45] decomb thread started for segment 1
[16:47:45] encx264: Encoding at constant RF 12.000000
x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
[16:47:45] decomb thread started for segment 0
[16:47:45] yadif thread started for segment 1
[16:47:45] yadif thread started for segment 0
x264 [info]: profile High, level 3.1
Encoding: task 1 of 1, 42.86 %[16:47:46] reader: done. 1 scr changes
Encoding: task 1 of 1, 79.37 % (14.99 fps, avg 21.95 fps, ETA 00h00m01s)[16:48:05] work: average encoding speed for job is 21.946354 fps
[16:48:05] sync: got 101 frames, 126 expected
[16:48:06] dvvideo-decoder done: 101 frames, 0 decoder errors, 0 drops
[16:48:06] render: lost time: 0 (0 frames)
[16:48:06] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:1     Avg QP:11.90  size: 79792  PSNR Mean Y:51.34 U:52.63 V:52.46 Avg:51.71 Global:51.71
x264 [info]: frame P:26    Avg QP:12.02  size: 75621  PSNR Mean Y:50.67 U:52.12 V:52.05 Avg:51.09 Global:51.06
x264 [info]: frame B:73    Avg QP:13.26  size: 44780  PSNR Mean Y:48.87 U:50.55 V:50.45 Avg:49.35 Global:49.32
x264 [info]: consecutive B-frames:  1.0%  0.0% 15.0% 84.0%
x264 [info]: mb I  I16..4:  1.9% 93.5%  4.6%
x264 [info]: mb P  I16..4:  1.0% 66.2%  1.8%  P16..4:  7.2% 14.4%  9.5%  0.0%  0.0%    skip: 0.0%
x264 [info]: mb B  I16..4:  0.2% 23.5%  0.2%  B16..8: 21.7% 13.4%  5.8%  direct:28.5%  skip: 6.8%  L0:28.2% L1:24.4% BI:47.3%
x264 [info]: 8x8 transform intra:97.1% inter:57.1%
x264 [info]: coded y,uvDC,uvAC intra: 99.6% 100.0% 99.8% inter: 78.1% 87.3% 57.7%
x264 [info]: i16 v,h,dc,p:  1%  4%  5% 91%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 19% 42%  4%  5%  4%  6%  4%  8%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 16% 21%  8% 12%  8% 10%  7%  9%
x264 [info]: i8c dc,h,v,p: 48% 29% 14%  9%
x264 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x264 [info]: ref P L0: 38.7% 10.6% 35.4% 15.2%
x264 [info]: ref B L0: 83.4% 12.7%  3.9%
x264 [info]: ref B L1: 96.4%  3.6%
x264 [info]: SSIM Mean Y:0.9900823 (20.036db)
x264 [info]: PSNR Mean Y:49.363 U:50.980 V:50.884 Avg:49.824 Global:49.731 kb/s:10629.79
Encoding: task 1 of 1, 79.37 % (14.99 fps, avg 21.95 fps, ETA 00h00m01s)[16:48:06] pcm_s16le-decoder done: 0 frames, 0 decoder errors, 0 drops
[16:48:06] mux: track 0, 100 frames, 5314853 bytes, 10629.71 kbps, fifo 128
[16:48:06] mux: track 1, 38 frames, 354794 bytes, 709.59 kbps, fifo 64
[16:48:06] decomb: deinterlaced 20 | blended 32 | unfiltered 48 | total 100
[16:48:06] libhb: work result = 0

Encode done!

Code: Select all

mediainfo movie.mkv 

General
Unique ID                                : 301184453423444444376238638857566672355 (0xE29604090ECD9BCF4321511C9B3DD5E3)
Complete name                            : movie.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 5.41 MiB
Duration                                 : 4s 0ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 11.4 Mbps
Writing application                      : HandBrake 4394svn
Writing library                          : libmkv 0.6.5

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 4s 0ms
Width                                    : 1 024 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 119
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=12.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Color primaries                          : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Audio
ID                                       : 2
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Codec ID                                 : A_FLAC
Duration                                 : 4s 0ms
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 KHz
Bit depth                                : 16 bits

Code: Select all

exiftool -G -H -a movie.mkv 
[ExifTool]           - ExifTool Version Number         : 8.60
[File]               - File Name                       : movie.mkv
[File]               - Directory                       : .
[File]               - File Size                       : 5.4 MB
[File]               - File Modification Date/Time     : 2012:01:14 16:48:06+01:00
[File]               - File Permissions                : rw-rw-r--
[File]               - File Type                       : MKV
[File]               - MIME Type                       : video/x-matroska
[Matroska]      0x0286 EBML Version                    : 1
[Matroska]      0x02f7 EBML Read Version               : 1
[Matroska]      0x0282 Doc Type                        : matroska
[Matroska]      0x0287 Doc Type Version                : 2
[Matroska]      0x0285 Doc Type Read Version           : 2
[Matroska]      0x0d80 Muxing App                      : libmkv 0.6.5
[Matroska]      0x1741 Writing App                     : HandBrake 4394svn
[Matroska]      0xad7b1 Timecode Scale                 : 1 ms
[Matroska]      0x0489 Duration                        : 4.00 s
[Matroska]      0x0057 Track Number                    : 1
[Matroska]      0x0003 Track Type                      : Video
[Matroska]      0x0006 Video Codec ID                  : V_MPEG4/ISO/AVC
[Matroska]      0x3e383 Video Frame Rate               : 25
[Matroska]      0x0008 Track Default                   : Yes
[Matroska]      0x0030 Image Width                     : 1024
[Matroska]      0x003a Image Height                    : 576
[Matroska]      0x14b0 Display Width                   : 1024
[Matroska]      0x14ba Display Height                  : 576
[Matroska]      0x0057 Track Number                    : 2
[Matroska]      0x0003 Track Type                      : Audio
[Matroska]      0x0006 Audio Codec ID                  : A_FLAC
[Matroska]      0x2b59c Track Language                 : und
[Matroska]      0x0008 Track Default                   : Yes
[Matroska]      0x0035 Audio Sample Rate               : 44100
[Matroska]      0x001f Audio Channels                  : 2
[Composite]          - Image Size                      : 1024x576
Last edited by Anonymous on Sun Jan 15, 2012 12:39 pm, edited 1 time in total.
Reason: [code] blocks
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

I tried flac with a 523M mpg-file, the size is nearly the same with -C5 and -C 8.

I agree that the quality was too high, but I am talking of the compression of flac.

Code: Select all

1188284347 2012-01-14 17:57 movie5.mkv (.C 5)
1187764401 2012-01-14 17:57 movie8.mkv (-C 8)
Is this possible?
Last edited by Anonymous on Sun Jan 15, 2012 12:38 pm, edited 1 time in total.
Reason: [code] blocks
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

Yes. The FLAC compression level only affects the size of the output by a few percent (less if you compare two compression levels that are close). Which is why you might as well use the default.
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

I saw there is a misunderstood option by me; -D 0.0,0.0. This is nonsense with 1 audio-stream. I don't understand "-D 0.0" too, is this default? What is a recommended value for a camcorder?
Deleted User 11865

Re: Best syntax for camcorder videos for video editing?

Post by Deleted User 11865 »

It only affects AC3 audio source tracks. You can just leave it out.
ssmokee
Posts: 8
Joined: Tue Dec 20, 2011 9:16 am

Re: Best syntax for camcorder videos for video editing?

Post by ssmokee »

linuxuser wrote:-a 1: 1 Audio stream is enough, but I don't know how I can select the better audio stream. Please see at the end. Does the dv-file contain the audio 2x with the same quality?

-E lame -B 320: don't know if there is an option for a better quality? I didn't find out if flac can be used
According to your post the source audio is 12bit 32KHz stereo, which is MUCH lower quality than CD. Personally I wouldn't bother FLACing a source with that low of a detail level. In your case I would just use a low bitrate MP3 or Vorbis transcode....no point in turning up the bitrate to 320Kbps as again the detail level is way below that of a CD. Even setting Lame to 128Kbps would in all likelyness still be overkill in this case.
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Best syntax for camcorder videos for video editing?

Post by linuxuser »

I use FLAC in the meantime. "-E lame -B 320" should be a setting which fits for better quality too. I decided to create a simple option file in the sourcefile-dir, which allows individual settings

example of an option file:

Code: Select all

X264QUALITY=23
AUDIOENCODER=lame -B 192
CROP=64:108:24:22
WIDTH=768
HEIGHT=432
FILTER=--decomb  --denoise
There are a lot of other individual and personal things, which I do, mainly renaming and checking for broken files, which lead to a different number of source and recoded files, but the following is the mainpart. Maybe it is for others an idea for an own script. Note: a video length of about 0.3 sec results in a broken file. I do not recommend to recode all the files with handbrake without looking at the logs. From time to time there can be clips with problems, which you don't expect, mainly because the sourcefile is somehow broken.

Code: Select all

i=1
find "$SOURCEDIR" -type f -name '*.avi' | sort | \
	while read -r SRCCLIP; do
	
		CLIPNO=`basename "$SRCCLIP" | cut -f 2 -d"_"`
		
		CLIPNOCHK="$(printf '%004i' $i)"
		
		if [ ! "$CLIPNOCHK" = "$CLIPNO" ] ; then
			echo "CHECK CLIPNO: $CLIPNO vs. $CLIPNOCHK"
			exit
		fi
	
		echo
		echo "--------------------------------------------------------------"
		echo "$CLIPNO of $AVIFILES"": "` basename "$SRCCLIP"`
		echo "--------------------------------------------------------------"
		echo
		sleep 1
	
	
		MKVFILE="$VIDEOEDITSOURCEDIR""/"`basename "$SRCCLIP" .avi`".mkv"
		
		FORMAT="mkv"
		ENCODER="x264"
		X264QUALITY=12
		WIDTH=1024
		HEIGHT=576
		CROP=0
		AUDIOTRACKS=1
		AUDIOENCODER="ffflac"
		AUDIOSAMPLERATE="44.1"
		FILTER="--decomb"
		X264OPTIONS="threads=1:b-adapt=2:rc-lookahead=50"
		
		OPTIONFILE=`dirname "$SRCCLIP"`"/""$PROJECTNAME"".make"
		
		echo
		if [ -f "$OPTIONFILE" ] ; then
			OPTIONSINMEM=`cat "$OPTIONFILE"`
			X264QUALITY_CUSTOM=`echo "$OPTIONSINMEM" | grep X264QUALITY`
			if test -n "$X264QUALITY_CUSTOM"; then
				X264QUALITY=`echo "$X264QUALITY_CUSTOM" | cut -f 2 -d"="`
				echo X264QUALITY $X264QUALITY
			fi
			AUDIOENCODER_CUSTOM=`echo "$OPTIONSINMEM" | grep AUDIOENCODER`
			if test -n "$AUDIOENCODER_CUSTOM"; then
				AUDIOENCODER=`echo "$AUDIOENCODER_CUSTOM" | cut -f 2 -d"="`
				echo AUDIOENCODER $AUDIOENCODER
			fi
			AUDIOSAMPLERATE_CUSTOM=`echo "$OPTIONSINMEM" | grep AUDIOSAMPLERATE`
			if test -n "$AUDIOSAMPLERATE_CUSTOM"; then
				AUDIOSAMPLERATE=`echo "$AUDIOSAMPLERATE_CUSTOM" | cut -f 2 -d"="`
				echo AUDIOSAMPLERATE $AUDIOSAMPLERATE
			fi
			CROP_CUSTOM=`echo "$OPTIONSINMEM" | grep CROP`
			if test -n "$CROP_CUSTOM"; then
				CROP=`echo "$CROP_CUSTOM" | cut -f 2 -d"="`
				echo CROP $CROP
			fi
			WIDTH_CUSTOM=`echo "$OPTIONSINMEM" | grep WIDTH`
			if test -n "$WIDTH_CUSTOM"; then
				WIDTH=`echo "$WIDTH_CUSTOM" | cut -f 2 -d"="`
				echo WIDTH $WIDTH
			fi
			HEIGHT_CUSTOM=`echo "$OPTIONSINMEM" | grep HEIGHT`
			if test -n "$HEIGHT_CUSTOM"; then
				HEIGHT=`echo "$HEIGHT_CUSTOM" | cut -f 2 -d"="`
				echo HEIGHT $HEIGHT
			fi
			FILTER_CUSTOM=`echo "$OPTIONSINMEM" | grep FILTER`
			if test -n "$FILTER_CUSTOM"; then
				FILTER=`echo "$FILTER_CUSTOM" | cut -f 2 -d"="`
				echo FILTER $FILTER
			fi
		else
			echo "using default options"
		fi
		echo
		
		
		if [ $CROP -eq 0 ] ; then
			HandBrakeCLI -i "$SRCCLIP" -f $FORMAT -e $ENCODER -q $X264QUALITY -w $WIDTH -l $HEIGHT -a $AUDIOTRACKS -E $AUDIOENCODER $ -R $AUDIOSAMPLERATE $FILTER -m -x $X264OPTIONS -o "$MKVFILE" </dev/null
		else
			HandBrakeCLI -i "$SRCCLIP" -f $FORMAT -e $ENCODER -q $X264QUALITY --crop $CROP -w $WIDTH -l $HEIGHT -a $AUDIOTRACKS -E $AUDIOENCODER -R $AUDIOSAMPLERATE $FILTER -m -x $X264OPTIONS -o "$MKVFILE" </dev/null
		fi
	
		let i=$i+1
	
done
Post Reply